When tabs are inserted or removed in a QTabBar, QTabBarPrivate::refresh() is called...
authorRobert Knight <robertknight@gmail.com>
Sun, 20 Apr 2008 14:28:31 +0000 (16:28 +0200)
committerLisandro Damián Nicanor Pérez Meyer <lisandro@debian.org>
Sat, 5 May 2018 01:53:17 +0000 (02:53 +0100)
Prior to Qt 4.4 this was not a problem because the geometry was
recalculated in QTabBar::sizeHint() if the layoutDirty variable was
set.  In Qt 4.4 however the layout caches size hint information in
QWidgetItemV2.  Since the cache information is not invalidated, the
layout may end up using out-of-date size hint information to compute
the widget size.

If the QTabBar is empty when QTabBar::sizeHint() is called, it will
return a size with a height of 0, which will be kept in the cache and
so the tab bar will never be shown.

This patch fixes the problem by calling updateGeometry() whenever the
tab bar's layout is refreshed.

qt-bugs@ issue : 208185
Trolltech task ID : 208349
bugs.kde.org number : 159014

Gbp-Pq: Name 0225-invalidate-tabbar-geometry-on-refresh.patch

src/gui/widgets/qtabbar.cpp

index fcc1ac7f771f4f2ab0a7b77b420838ccd2f0718f..13b193864457ef7033db9e3b7f502f7115ef8f9a 100644 (file)
@@ -723,8 +723,8 @@ void QTabBarPrivate::refresh()
         layoutTabs();
         makeVisible(currentIndex);
         q->update();
-        q->updateGeometry();
     }
+    q->updateGeometry();
 }
 
 /*!