Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-140425

QTabBar flickering/jumping on resize

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important 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)

        1. tabbarissue.pro
          0.5 kB
        2. tabbar_jumping.gif
          tabbar_jumping.gif
          597 kB
        3. main.cpp
          0.5 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            roman_schuh Roman Schuh
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes