QBrush之材质画刷(Qt::BrushStyle::TexturePattern)
 1 void Widget::paintEvent(QPaintEvent *event)
 2 {
 3     Q_UNUSED(event);
 4 
 5     QPainter painter(this);
 6 
 7     painter.fillRect(this->rect(),QBrush(QColor(255,255,255)));
 8     painter.setRenderHint(QPainter::Antialiasing);//抗锯齿
 9 
10     QBrush brush;
11     brush.setColor(QColor(255,0,0));
12     brush.setTexture(QPixmap("f:/root1.png"));
13     painter.setBrush(brush);
14     painter.drawEllipse(0,0,this->width(),this->height());
15 }

image