效果图:
void WgtText::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setBrush(QBrush(Qt::blue, Qt::CrossPattern));
painter.drawRect(10,10,300,300);
return QWidget::paintEvent(event);
}