[Qt-interest] Problems with QTextObjectInterface and QTextEdit

Wilhelm wilhelm.meier at fh-kl.de
Wed Jun 1 22:07:19 CEST 2011


Hi all,

I have some problems using QTextEdit and a QTextObjectInterface. As an
minimal example I used the richtext example from the qt-sources:

http://doc.qt.nokia.com/latest/richtext-textobject.html

Then I extended the example with the possibility to scale the inserted
images (well, due to the simplicity of the example, all images are
scaled equally).

The problem is now that the heights of the individual lines of the
QTextEdit don't scale correct if the images are scaled *after* they have
been inserted.

If I change the scaleFactor for the inserted images I send an update()
signal from the documents layout. I also tried to send an
contentsChanged() signal from the document itself. But without luck.

Enclosed you find the complete source (I added some comments to the
lines I added or changed from the original example) and some screenshots:

s1.png: after inserting the image
s2.png: inserted text before the image
s3.png: changed image scalefactor from 0.1 to 0.2 (error: the image
obscures the text above)
s4.png: adding additional text before the image (error)
s5.png: adding blank lines (error)

Sure I'm missing the point here - any hints?

-- 
Wilhelm

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test05.tgz
Type: application/x-compressed-tar
Size: 6977 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110601/cbba689a/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: s5.png
Type: image/png
Size: 8799 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110601/cbba689a/attachment.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: s4.png
Type: image/png
Size: 7686 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110601/cbba689a/attachment-0001.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: s3.png
Type: image/png
Size: 7221 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110601/cbba689a/attachment-0002.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: s2.png
Type: image/png
Size: 7911 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110601/cbba689a/attachment-0003.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: s1.png
Type: image/png
Size: 6518 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110601/cbba689a/attachment-0004.png 


More information about the Qt-interest-old mailing list