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

QTabBar: does not invalidate geometry when tabs are inserted or removed whilst hidden [PATCH]

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P3: Somewhat important
    • Some future release
    • 4.4.0
    • Widgets: Layout
    • None

    Description

      QTabBar does not invalidate geometry when tabs are inserted or removed whilst hidden

      QTabBarPrivate::refresh() is called to update a QTabBar when tabs are inserted or removed. When the widget is hidden, it sets a boolean (layoutDirty) to true and returns. This means that the parent widget's layout is not notified about the possible geometry change.

      In Qt 4.3 and prior this was not a problem because the tab bar layout would be recalculated whenever QTabBar::sizeHint() was called. In Qt 4.4 however the QWidgetItemV2 in the layout caches the size hint information, so QTabBar::sizeHint() is not always called after tabs are inserted or removed because the layout is unaware that its cached size hint is no longer valid.

      If the tab bar is empty when QTabBar::sizeHint() is first called it will return a height of 0 and so, since QTabBar::sizeHint() is not called again, the tab bar will never be shown.

      The patch below fixes the problem by calling always calling updageGeometry() in QTabBarPrivate::refresh()

      Index: qtabbar.cpp
      ===================================================================
      — qtabbar.cpp (revision 796858)
      +++ qtabbar.cpp (working copy)
      @@ -533,8 +533,8 @@
      layoutTabs();
      makeVisible(currentIndex);
      q->update();

      • q->updateGeometry();
        }
        + q->updateGeometry();
        }

      /*!

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            smd Jan Arve
            sanonymous Nokia Qt Support (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes