Thank you, and I just solve it.
p.save();
// set the text style here
p.drawText(..., myText); // place it wherever with the alignment flag
p.restore();
//then:
{
setPixmap();
...
}
In other word, I did what someone suggested. put the text on top of the image at first, before the image is mapped into the pixmap.
QPainter p(&myImage);
p.save();
// set the text style here
p.drawText(..., myText); // place it wherever with the alignment flag
p.restore();
//then:
void myLabel::setImage(QImage myImage, QString myText)
{
QPixmap pixmap = QPixmap::fromImage(myImage);
setPixmap();
...
}
In other word, I did what someone suggested. put the text on top of the image at first, before the image is mapped into the pixmap.
To copy to clipboard, switch view to plain text mode
Bookmarks