Details
-
Bug
-
Resolution: Won't Do
-
P2: Important
-
None
-
5.15.1, 5.15.2
-
None
Description
In general it looks like if there are object replacement characters in the document eventually rendered as pictures then idealWidth() reports too small value (enough for the text but not for the image). This wasn't the case with Qt 5.14 and before. I don't remember about Qt 5.15.0 but it's quite regularly reproducible with 5.15.1.
I also checked my implementation of QTextObjectInterface::intrinsicSize and it always returns correct values.
So imagine a html like
<table><tr> <td><object replacement character here></td> <td>Any text</td> </tr></table>
Which we set to a QTextDocument, which is then rendered from the reimplemented paint event of QFrame.
QTextDocument::adjustSize is called in advance and QFrame is resized according to idealWidth of the document. (I tried to resize both before and after show event of QFrame, setting doc's idealWidth as QFrame width).
In this case "Any text" can rendered over the object in the first column as if intrinsicSize of the object returned invalid small size, but intrinsicSize always returns valid sizes, so it's not the case.
I have to notice it's not always reproducible. For example if we take the html above and the text on the right is relatively small then everything will be rendered correctly. With longer texts it starts rendering over the object.
Example how it looks like while intrinsicSize returned 96x96 (slightly more than real size of the picture).
I probably won't provide minimal reproducible example. Maybe someone else with the same problem will.
But the code I tested with is there https://github.com/psi-im/psi/blob/master/src/widgets/psitiplabel.cpp