From 2267aa761b5da2cae4629dca96034646fd72a0e6 Mon Sep 17 00:00:00 2001 From: PaddleStroke Date: Wed, 24 Apr 2024 14:42:48 +0200 Subject: [PATCH] Core: TabBar: fix issue following #13508 --- src/Gui/WorkbenchSelector.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Gui/WorkbenchSelector.cpp b/src/Gui/WorkbenchSelector.cpp index 8d9b395edb..68e92a934e 100644 --- a/src/Gui/WorkbenchSelector.cpp +++ b/src/Gui/WorkbenchSelector.cpp @@ -117,7 +117,7 @@ WorkbenchTabWidget::WorkbenchTabWidget(WorkbenchGroup* aGroup, QWidget* parent) std::string activeWbName = WorkbenchManager::instance()->activeName(); for (int i = 0; i < count(); ++i) { if (wbActionGroup->actions()[i]->objectName().toStdString() == activeWbName) { - setCurrentIndex(i); + setCurrentIndex(i + 1); break; } } @@ -145,7 +145,10 @@ WorkbenchTabWidget::WorkbenchTabWidget(WorkbenchGroup* aGroup, QWidget* parent) refreshList(aGroup->getEnabledWbActions()); connect(aGroup, &WorkbenchGroup::workbenchListRefreshed, this, &WorkbenchTabWidget::refreshList); connect(aGroup->groupAction(), &QActionGroup::triggered, this, [this, aGroup](QAction* action) { - int index = std::min(aGroup->actions().indexOf(action), this->count() - 1); + int index = aGroup->actions().indexOf(action) + 1; + if (index > this->count() - 1) { + index = 0; + } setCurrentIndex(index); }); connect(this, qOverload(&QTabBar::tabBarClicked), aGroup, [aGroup, moreAction](int index) {