From f619f0769ae049214e971ad7931680966e4b8068 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 25 Apr 2013 10:00:28 +0200 Subject: Fix a logic error in unpinTab In previous code the method was unable to properly determine the first available index not pinned under some circumstances BUG: 317798 --- src/tabwindow/tabbar.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/tabwindow/tabbar.cpp') diff --git a/src/tabwindow/tabbar.cpp b/src/tabwindow/tabbar.cpp index 7363d965..1ca3d4c2 100644 --- a/src/tabwindow/tabbar.cpp +++ b/src/tabwindow/tabbar.cpp @@ -579,10 +579,7 @@ void TabBar::unpinTab() return; int index = a->data().toInt(); - - // set the tab data false to forget this pinned tab - setTabData(index, false); - + // Find the available index to move int availableIndex = 0; for (int i = 1; i < count(); i++) @@ -592,8 +589,9 @@ void TabBar::unpinTab() availableIndex = i - 1; break; } + availableIndex++; } - + TabWidget *w = qobject_cast(parent()); w->moveTab(index, availableIndex); index = availableIndex; @@ -601,6 +599,9 @@ void TabBar::unpinTab() tabButton(index, QTabBar::RightSide)->show(); setTabText(index, w->webWindow(index)->title()); + // set the tab data false to forget this pinned tab + setTabData(index, false); + // workaround: "fix" the icon (or at least, try to...) QLabel *label = qobject_cast(tabButton(index, QTabBar::LeftSide)); if (!label) -- cgit v1.2.1