Why does the QTextCursor.insertImage exist when it's not possible to get the image
Hello forum,
I spendet a lot of hour just to add images to a QTextDocument (ok that was fast) but I can't get the picture out from this QTextDocument. Why in the hell is there a insertImage if it's not possible to get the picture. I have to save this QTextDocument and maybe edit it. Or is there another possibility for using RichText?
Greetings and thanks for your answer.
kea_
Re: Why does the QTextCursor.insertImage exist when it's not possible to get the imag
Create a QTextCursor and position it somewhere where the image is(you can iterate over the document until you find an image). In order to know if your cursor is on the image call charFormat(), then on the returned QTextCharFormat call isImageFormat(). If isImageFormat() returns true then cast the QTextCharFormat object to QTextImageFormat, then call the name() method. Using the name you can iterate over some of your created caches for images(maybe QHash<QString, QPixmap>) and get the real image. :)
Re: Why does the QTextCursor.insertImage exist when it's not possible to get the imag
Thank you very much for your answer.
I will check it out the next days.
Greetings kea_
Re: Why does the QTextCursor.insertImage exist when it's not possible to get the imag
Glad I helped. My hints were not very accurate as I see but I haven't doing this since a long time. Nice that you figured it out. :)