QTabBar: don't overwrite data, fix refactoring error for vertical tabs

Amends 359616066e64eed947c6c91cb8902285ed79dd0d, which incorrectly
changed

-            tabList[i].minRect = QRect(0, miny, sz.width(), sz.height());
+            tab->data = QRect(0, miny, sz.width(), sz.height());

in the code laying out verticals tabs (correct done for the horizontal
case).

Since QDockWidget uses the user data for tabs to maintain the mapping
between tabs and dock widget, this broke the layout logic.

Fixes: QTBUG-95841
Change-Id: Ie785e1205b426bbc4954b965f619f4c603490f76
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 7188e650775ffd2bf4f2574094b6472c86468fba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Volker Hilsheimer 2021-08-18 12:54:14 +02:00 committed by Qt Cherry-pick Bot
parent 4d94255149
commit 6caa4e3aa0

View File

@ -523,7 +523,7 @@ void QTabBarPrivate::layoutTabs()
y += sz.height();
maxWidth = qMax(maxWidth, sz.width());
sz = q->minimumTabSizeHint(i);
tab->data = QRect(0, miny, sz.width(), sz.height());
tab->minRect = QRect(0, miny, sz.width(), sz.height());
miny += sz.height();
tabChain[tabChainIndex].init();
tabChain[tabChainIndex].sizeHint = tab->maxRect.height();