From 683eab16ee15d7489e2b6b418684f3c09b7f854b Mon Sep 17 00:00:00 2001 From: Sen66 Date: Thu, 5 Mar 2026 14:25:49 +0100 Subject: [PATCH] fix: better fix to switch to newly created class --- src/main.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index d2405a3..7f0a6f2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1572,14 +1572,13 @@ QDockWidget* MainWindow::createTab(RcxDocument* doc) { dock->raise(); dock->show(); - // Ensure the new dock's tab is activated in the tab bar + // Ensure the new dock's tab is activated in the tab bar. + // Since we tabify with the last dock, the new tab is always appended last. for (auto* tabBar : findChildren()) { if (tabBar->parent() != this) continue; - for (int i = 0; i < tabBar->count(); i++) { - if (tabBar->tabText(i) == dock->windowTitle()) { - tabBar->setCurrentIndex(i); - break; - } + if (tabBar->count() > 0) { + tabBar->setCurrentIndex(tabBar->count() - 1); + break; } }