-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.9.0
-
None
Issue:
When a QTabBar is resized to a size smaller than the current tab the scroll position starts to jump.
Cause:
This happens due to <QTabBarPrivate::makeVisible> not accounting for the case where the tab rect is larger than the tabbar rect. The tab bar will keep switching between scrolling to the left and to the right on every resize event.
void QTabBarPrivate::makeVisible(int index) { ... if (available >= lastTabEnd) { // the entire tabbar fits, reset scroll scrollOffset = 0; } else if (tabStart < scrolledTabBarStart) { // Tab is outside on the left, so scroll left. scrollOffset = tabStart - scrollRect.left(); } else if (tabEnd > scrolledTabBarEnd) { // Tab is outside on the right, so scroll right. scrollOffset = qMax(0, tabEnd - scrollRect.right()); } else if (scrollOffset + entireScrollRect.width() > lastTabEnd + 1) { // fill any free space on the right without overshooting scrollOffset = qMax(0, lastTabEnd - entireScrollRect.width() + 1); } ... }
Suggested solution:
The tab bar should probably always scroll to the left or to the right when the tab rect is larger than the tab bar rect.
How to reproduce with provided example application:
1) Start application
2) Select 2nd or 3rd tab.
3) Resize main window to be smaller than the tab rect.
4) Tab will start to flicker/jump (BUG)