From 4f79b8692c6feb0bf1e30fb9e51b7669aa9074b1 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sat, 2 Nov 2024 15:01:48 +0100 Subject: [PATCH] FancyTabWidget: Only set text and tooltip for inserted tab --- src/widgets/fancytabwidget.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/widgets/fancytabwidget.cpp b/src/widgets/fancytabwidget.cpp index 04f410d105..5f4a8ee6b4 100644 --- a/src/widgets/fancytabwidget.cpp +++ b/src/widgets/fancytabwidget.cpp @@ -234,16 +234,12 @@ int FancyTabWidget::InsertTab(const int preffered_index, FancyTabData *tab) { tabBar()->setTabData(actual_index, QVariant::fromValue(tab)); if (mode_ == Mode::IconOnlyTabs || mode_ == Mode::IconsSidebar) { - for (int i = 0; i < count(); ++i) { - tabBar()->setTabText(i, ""_L1); - tabBar()->setTabToolTip(i, tabBar()->tabData(i).value()->label()); - } + tabBar()->setTabText(actual_index, ""_L1); + tabBar()->setTabToolTip(actual_index, tabBar()->tabData(actual_index).value()->label()); } else { - for (int i = 0; i < count(); ++i) { - tabBar()->setTabText(i, tabBar()->tabData(i).value()->label()); - tabBar()->setTabToolTip(i, ""_L1); - } + tabBar()->setTabText(actual_index, tabBar()->tabData(actual_index).value()->label()); + tabBar()->setTabToolTip(actual_index, ""_L1); } return actual_index;