Well, my bad after all
.
Looks like you have to build a QTextImageFormat.
You will have to set the name, width and height for the image format.
The name must be the name of the pixmap the label currently displays.
So you're back at square one. This can be solved as follows:
every time you set a different pixmap to the label, also add a dynamic property to it. The dynamic property will hold the name of the image:
freeslabel->setPixmap(erf);
freesLabel->setProperty("imagePath", ":/images/erf.png");
QPixmap erf = (QPixmap(":/images/erf.png");
freeslabel->setPixmap(erf);
freesLabel->setProperty("imagePath", ":/images/erf.png");
To copy to clipboard, switch view to plain text mode
Now, when you wish to insert the image:
imgfmt->setName(freesLabel->property("imagePath").toString());
imgfmt->setWidth(freesLabel->pixmap()->width());
imgfmt->setHeight(freesLabel->pixmap()->height());
cursor.insertImage(imgfmt);
QTextImageFormat imgfmt;
imgfmt->setName(freesLabel->property("imagePath").toString());
imgfmt->setWidth(freesLabel->pixmap()->width());
imgfmt->setHeight(freesLabel->pixmap()->height());
cursor.insertImage(imgfmt);
To copy to clipboard, switch view to plain text mode
Hopefully this should work.
Regards
Bookmarks