Simple situation: I have an object, which has a QPixmap
member. Object first created (pixmap is null now), then pixmap readed from data base and inserted in obj
I put this in another answer to be able to format the code. I wrote the following program and it works as intended:
#include
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget window;
window.resize(320, 240);
window.show();
window.setWindowTitle(
QApplication::translate("toplevel", "Top-level widget"));
QLabel* label = new QLabel(&window);
label->setTextFormat(Qt::RichText);
QString text = "Test
here is an image: ";
QPixmap pixmap("testicon.jpg");
QByteArray byteArray;
QBuffer buffer(&byteArray);
pixmap.save(&buffer, "PNG");
QString url = QString("
";
text += url;
text += "";
label->setText(text);
label->move(100, 100);
label->show();
return app.exec();
}