Qt 绘制圆角 QWidget

来源:互联网 发布:mysql压缩包安装配置 编辑:程序博客网 时间:2024/06/06 03:06

实现功能:使用 image 填充圆角 QWidget

/*QPainter painter(this);    painter.drawImage(0, 0, image); */    QPainter painter(this);    QBrush brush;    /*    If you don't like monochrome image    You are ought to read document about     QBrush::setTextureImage    */    brush.setTextureImage(QImage(image));     painter.setBrush(brush);    painter.setPen(Qt::black);      painter.drawRoundedRect(this->rect(), 10, 10); 
原创粉丝点击