Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.2
-
None
-
Windows 10, but debugging the code, I am sure it can be reproduced on any platform.
Description
I have a qss with specified max-width:
QToolTip { max-width: 300px; }
If the tooltip-text is short or consist of multiple short lines - it works fine. But once it get bigger, and occupy more lines, it does not extend the height of the tooltip properly.
To illustrate the problem, I will use Qt designer, as the issue easily reproducable there:
It is default tooltip-size (without restrictions).
Now, I will specify style-sheet for main-window:
QToolTip { max-width: 200px; }
Actual result: As your can see, the height stays the same, the width decreased, so the text does not fit.
Expected result: The height of the tooltip is not limited - so it should be increased!
Suggested fix:
https://code.woboq.org/qt5/qtbase/src/widgets/widgets/qlabel.cpp.html#643
return (contentsSize + contentsMargin).expandedTo(q->minimumSize());
I think, here should be
return (contentsSize + contentsMargin).expandedTo(q->minimumSize()).boundedTo(q->maximumSize());
But this suggestion might be mistaken because it is `QLabel` code, and it probably works fine probably fix should be in `QToolTip` code.