Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.5.0
-
None
-
-
8c18a245b (dev), 0c9787bab (6.6), c26e7f278 (6.5)
Description
When building the attached Qt Creator project, I get following output in Qt 5.12:
While I get following output in Qt 6.5:
The left widget is a QTreeWidget having AdjustToContents as sizeAndAdjustPolicy.
The QTreeWidget is placed in a QHBoxLayout next to a QLineEdit. As the QLineEdit has a bigger stretch factor, we would expect a result as in Qt 5.12.
When starting the Qt 6.5 application, you can see the QTreeWidget grows from the 'normal' size (aka the size in Qt 5.12) until no place is left in the main widget. (see attached video)
I looked around in the Qt code and came across this change: https://codereview.qt-project.org/c/qt/qtbase/+/235582
It changes the location where the size of the scrollbar is taken into account which is fine. But it also changes the way to check the scrollbar visibility. Before it was using the isVisible() call, while now it is done using the isHidden() call.
However the scrollbar itself is never hidden/made visible, but the wrapper around it (aka the QAbstractScrollAreaScrollBarContainer).
When changing the visibility check for the scrollBars in QAbstractScrollArea::sizeHint() from d->vbar->isHidden() to d->scrollBarContainers[Qt::Vertical]->isHidden() it works correct again. (of course the same should be done for the horizontal scrollbar)
Attachments
Issue Links
- duplicates
-
QTBUG-109326 QTableView and QTreeView with Fixed vertical size policy and AdjustToContents sizeAdjustPolicy always reserve space for horizontal scroll bar
- Closed
- resulted from
-
QTBUG-69120 QTreeView viewportSizeHint is wrong when called before showing the widget
- Closed