From 0e854314057fc70a238ee5d9928a9e8c883fc34b Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Thu, 11 Oct 2018 09:21:01 +0200 Subject: [PATCH] Changed stylesheet to highlight the active tab to improve debugging --- src/DockAreaTabBar.cpp | 4 ++++ src/DockAreaTabBar.h | 4 +++- src/stylesheets/default.css | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/DockAreaTabBar.cpp b/src/DockAreaTabBar.cpp index e32cbce..374fd79 100644 --- a/src/DockAreaTabBar.cpp +++ b/src/DockAreaTabBar.cpp @@ -257,6 +257,10 @@ void CDockAreaTabBar::insertTab(int Index, CDockWidgetTab* Tab) d->TabsLayout->insertWidget(Index, Tab); connect(Tab, SIGNAL(clicked()), this, SLOT(onTabClicked())); d->MenuOutdated = true; + if (Index <= d->CurrentIndex) + { + d->CurrentIndex++; + } } diff --git a/src/DockAreaTabBar.h b/src/DockAreaTabBar.h index 86a46b8..a683dc2 100644 --- a/src/DockAreaTabBar.h +++ b/src/DockAreaTabBar.h @@ -73,7 +73,9 @@ public: virtual ~CDockAreaTabBar(); /** - * Inserts the given dock widget tab at the given position + * Inserts the given dock widget tab at the given position. + * Inserting a new tab at an index less than or equal to the current index + * will increment the current index, but keep the current tab. */ void insertTab(int Index, CDockWidgetTab* Tab); diff --git a/src/stylesheets/default.css b/src/stylesheets/default.css index 1a676ca..b2301d7 100644 --- a/src/stylesheets/default.css +++ b/src/stylesheets/default.css @@ -36,7 +36,8 @@ ads--CDockWidgetTab ads--CDockWidgetTab[activeTab="true"] { - background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:0.5, stop:0 palette(window), stop:1 palette(light)); + /*background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:0.5, stop:0 palette(window), stop:1 palette(light));*/ + background: palette(highlight); } ads--CDockWidgetTab QLabel