void test::paintEvent(QPaintEvent *){ QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing, true); QFont font; int fontHeight = height()*0.7; font.setPixelSize(fontHeight); painter.setFont(font); QPen pen; //pen.setBrush(QBrush(QPixmap("c:\\test.png").scaled(rect().size()))); pen.setBrush(QBrush(QPixmap("c:\\test1.png").scaled(rect().size()))); painter.setPen(pen); painter.drawText(rect(), Qt::AlignCenter, "test"); }
int fontHeight = height()*0.7;
C++ (Qt)QBrush::QBrush ( const QGradient & gradient )
pen.setBrush(QBrush(QPixmap("c:\\test1.png").scaled(rect().size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation)));