In reverse order:
if (pixmap.isNull())
...
QPixmap pixmap(filename);
if (pixmap.isNull())
...
To copy to clipboard, switch view to plain text mode
class MySuperCoolLabel
(QLabel);
{
painter.save();
painter.drawPixmap(0, 0, my_pixmap);
painter.setFont(font());
painter.drawText(x, y, my_text);
painter.restore();
}
class MySuperCoolLabel (QLabel);
void MySuperCoolLabel::paintEvent (QPaintEvent *event)
{
painter = QPainter(this);
painter.save();
painter.drawPixmap(0, 0, my_pixmap);
painter.setFont(font());
painter.drawText(x, y, my_text);
painter.restore();
}
To copy to clipboard, switch view to plain text mode
Please read the class documentation in addition to the tutorials.
Bookmarks