Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.6.2, 5.9.2
-
None
-
Windows 10
-
b64f3f6ca97e299176ca8990402650552a90f704
Description
When a QTabWidget's tab bar is hidden (either manually or with QTabWidget::setTabBarAutoHide()), QTabWidget::sizeHint() still adds the bar's height to its result. This leads to unexpected behaviour when putting the QTabWidget inside e.g. a QScrollArea: when resizing the scroll area, the vertical scroll bar is shown before the contained widget has reached its expected minimum size.
The attached sample program creates two windows, both with a QScrollArea, containing a QTabWidget. One tab widget only has one tab (hidden due to QTabWidget::setTabBarAutoHide(true)), another with two tabs. Each tab is a green, fixed height widget on top of a red, expandable widget with zero minimum height.
Here, the scroll areas are large enough to not need a scroll bar:
Reducing the height slightly, both widgets show a vertical scroll bar:
On the right, I would have expected the red widget to be resized to fit inside the smaller window, so no vertical scroll bar would be necessary.