Details
-
Bug
-
Resolution: Incomplete
-
P2: Important
-
None
-
4.8.5, 5.2.0
-
None
-
Windows 7
Visual Studio 2013
qt-everywhere-opensource-src-5.2.0 (built from source)
Description
I try to draw an unbounded text using QStaticText:
QStaticText text; //text.setTextWidth(400); // (1) text.setText("The quick brown fox jumps over the lazy dog"); //text.setTextFormat(Qt::RichText); // (2) painter.drawStaticText(0, 0, text); painter.drawRect(QRectF{{0, 0}, text.size()});
Everything is fine here and I get the picture ok1.png. If I uncomment the line (1) to put some arbitrary bounds on the text width it is also ok and the picture becomes ok2.png. So, the plain text rendering is perfectly fine.
Now if I uncomment (2) to switch to the rich text format I get bug1.png and bug2.png respectively which seems to be wrong. The expected behaviour is the same as for the plain text format. But instead I see a strange text wrapping in the case when the text width is not restricted at all ((1) commented, bug1.png), and a QStaticText::size() inconsistency with the actual text rendering in the second case when the text width is restricted but far beyond the actual text width ((1) uncommented, bug2.png).
Attachments
Issue Links
- relates to
-
QTBUG-116651 QGraphicsTextItem: Width of HTML list item in table constrained when setTextWidth set
-
- Reported
-