From 2283b41fdcac1b04107593bc0c56a0cdfc412ca4 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Tue, 6 Feb 2018 17:33:18 +0100 Subject: [PATCH] TabBar: Fix calculating pinned tab width It takes into account cornerWidth and calculates correct value with RTL. For the last time now hopefully. --- src/lib/tabwidget/tabbar.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/tabwidget/tabbar.cpp b/src/lib/tabwidget/tabbar.cpp index 5179ceb99..911b62585 100644 --- a/src/lib/tabwidget/tabbar.cpp +++ b/src/lib/tabwidget/tabbar.cpp @@ -464,10 +464,10 @@ void TabBar::tabInserted(int index) return; } QWidget *w = tabButton(0, iconButtonPosition()); - const QRect r = tabRect(0); - if (w && r.isValid()) { - const int padding = w->geometry().x() - r.x(); - tabMetrics()->setPinnedWidth(iconButtonSize().width() + padding * 2); + if (w && w->parentWidget()) { + const QRect wg = w->parentWidget()->geometry(); + const QRect wr = QStyle::visualRect(layoutDirection(), wg, w->geometry()); + tabMetrics()->setPinnedWidth(iconButtonSize().width() + wr.x() * 2); setUpLayout(); } });