View Issue Details

IDProjectCategoryView StatusLast Update
0017926ScribusUser Interfacepublic2026-09-10 06:54
Reporterqirat Assigned Tojghali  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinuxOSFedora WorkstationOS Version44
Product Version1.7.4.svn 
Fixed in Version1.7.4.svn 
Summary0017926: [PATCH] Dark theme: switching theme leaves dock panel tabs styled for the previous theme
DescriptionSwitching theme in Preferences leaves dock panel tabs styled for the previous theme (e.g. old active-tab highlight colour) until app restart.
Steps To ReproducePreferences → switch theme (Light↔Dark) → dock tabs don't update.
Additional InformationRoot cause:
ADS reloads its bundled stylesheet on a posted ApplicationPaletteChange event; Scribus's own setStyleSheet() reran too early, racing it.

Fix:
Queue setStyleSheet() via QMetaObject::invokeMethod(..., Qt::QueuedConnection) so it runs after ADS's reload.

File:
scribus.cpp.

Patch:
dark-theme-live-toggle-stale-dock-stylesheet-fix-v1.02.patch (1 file, 0000010:0000007 lines).
Tags#please_test
Attached Files
dark-theme-live-toggle-stale-dock-stylesheet-fix-v1.02.patch (827 bytes)   
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(revision 27771)
+++ scribus/scribus.cpp	(working copy)
@@ -6587,6 +6587,13 @@
 			ScribusProxyStyle::instance()->setApplicationTheme(ScribusProxyStyle::ApplicationTheme::Light);
 		else
 			ScribusProxyStyle::instance()->setApplicationTheme(ScribusProxyStyle::ApplicationTheme::System);
+
+		// setApplicationTheme() changes the app palette, which ADS's own
+		// CDockManager reacts to by reloading its bundled stylesheet over
+		// ours (scribus.css) via a posted ApplicationPaletteChange event,
+		// landing after this call returns. Queued so this runs after that
+		// event has landed, not before.
+		QMetaObject::invokeMethod(this, [this]() { setStyleSheet(); }, Qt::QueuedConnection);
 	}
 #endif
 
live-theme-toggle-blue-bg1.png (15,017 bytes)   
live-theme-toggle-blue-bg1.png (15,017 bytes)   
live-theme-toggle-blue-bg2.png (10,242 bytes)   
live-theme-toggle-blue-bg2.png (10,242 bytes)   
PatchYes

Activities

qirat

2026-08-29 03:29

reporter   ~0054366

Here is a new improved version: refreshes dock styling and PageSelector icons immediately; no restart needed, with safer Qt signal connection.

The initial number in the filename suggests the order it is to go while testing my four dark theme fixes (tickets in order: 0017923, 0017924, 0017925, and 0017926).
4_dark-theme-live-toggle-stale-dock-stylesheet-fix-v1.07.patch (2,217 bytes)   
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(revision 27791 + preceding dark-theme fixes)
+++ scribus/scribus.cpp	(working copy)
@@ -467,7 +467,7 @@
 	setStyleSheet();
 
 #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
-	connect(QGuiApplication::styleHints(), &QStyleHints::colorSchemeChanged, [this]()
+	connect(QGuiApplication::styleHints(), &QStyleHints::colorSchemeChanged, this, [this]()
 	{
 		emit ScQApp->iconSetChanged();
 		// THIS IS A WORKAROUND!
@@ -6593,6 +6593,10 @@
 			ScribusProxyStyle::instance()->setApplicationTheme(ScribusProxyStyle::ApplicationTheme::Light);
 		else
 			ScribusProxyStyle::instance()->setApplicationTheme(ScribusProxyStyle::ApplicationTheme::System);
+
+		// ADS reloads its bundled stylesheet after the palette change. Reapply
+		// the Scribus stylesheet after that queued palette-change handling.
+		QMetaObject::invokeMethod(this, [this]() { setStyleSheet(); }, Qt::QueuedConnection);
 	}
 #endif
 
Index: scribus/ui/pageselector.cpp
===================================================================
--- scribus/ui/pageselector.cpp	(revision 27791 + preceding dark-theme fixes)
+++ scribus/ui/pageselector.cpp	(working copy)
@@ -48,11 +48,6 @@
 	forwardButton->setAutoDefault( false );
 	lastButton->setAutoDefault( false );
 
-	startButton->setIcon(IconManager::instance().loadIcon("go-first"));
-	backButton->setIcon(IconManager::instance().loadIcon("go-previous"));
-	forwardButton->setIcon(IconManager::instance().loadIcon("go-next"));
-	lastButton->setIcon(IconManager::instance().loadIcon("go-last"));
-
 	startButton->setFocusPolicy(Qt::NoFocus);
 	backButton->setFocusPolicy(Qt::NoFocus);
 	forwardButton->setFocusPolicy(Qt::NoFocus);
@@ -206,6 +201,12 @@
 
 void PageSelector::iconSetChange()
 {
+	IconManager& iconManager = IconManager::instance();
+	startButton->setIcon(iconManager.loadIcon("go-first"));
+	backButton->setIcon(iconManager.loadIcon("go-previous"));
+	forwardButton->setIcon(iconManager.loadIcon("go-next"));
+	lastButton->setIcon(iconManager.loadIcon("go-last"));
+
 	QByteArray stylesheet;
 	if (loadRawText(ScPaths::instance().libDir() + "scribus.css", stylesheet))
 	{

qirat

2026-08-29 10:19

reporter   ~0054369

Here is v1.08:

- Keeps the previous fixes for stale ADS styling and PageSelector icons.
- New in v1.08: refreshes QMdiArea’s stored background brush after palette changes.
- Fixes the main work area retaining the old Light/Dark colour after a live theme switch.
- No change to normal startup appearance.
4_dark-theme-live-toggle-stale-dock-stylesheet-fix-v1.08.patch (2,542 bytes)   
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(revision 27791 + preceding dark-theme fixes)
+++ scribus/scribus.cpp	(working copy)
@@ -467,7 +467,7 @@
 	setStyleSheet();
 
 #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
-	connect(QGuiApplication::styleHints(), &QStyleHints::colorSchemeChanged, [this]()
+	connect(QGuiApplication::styleHints(), &QStyleHints::colorSchemeChanged, this, [this]()
 	{
 		emit ScQApp->iconSetChanged();
 		// THIS IS A WORKAROUND!
@@ -637,6 +637,9 @@
 	modeToolBar->setStyleSheet(stylesheet);
 	pdfToolBar->setStyleSheet(stylesheet);
 	viewToolBar->setStyleSheet(stylesheet);
+
+	// QMdiArea stores its background brush, so refresh it after palette changes.
+	mdiArea->setBackground(QApplication::palette().brush(QPalette::Active, QPalette::Dark));
 }
 
 
@@ -6593,6 +6596,10 @@
 			ScribusProxyStyle::instance()->setApplicationTheme(ScribusProxyStyle::ApplicationTheme::Light);
 		else
 			ScribusProxyStyle::instance()->setApplicationTheme(ScribusProxyStyle::ApplicationTheme::System);
+
+		// ADS reloads its bundled stylesheet after the palette change. Reapply
+		// the Scribus stylesheet after that queued palette-change handling.
+		QMetaObject::invokeMethod(this, [this]() { setStyleSheet(); }, Qt::QueuedConnection);
 	}
 #endif
 
Index: scribus/ui/pageselector.cpp
===================================================================
--- scribus/ui/pageselector.cpp	(revision 27791 + preceding dark-theme fixes)
+++ scribus/ui/pageselector.cpp	(working copy)
@@ -48,11 +48,6 @@
 	forwardButton->setAutoDefault( false );
 	lastButton->setAutoDefault( false );
 
-	startButton->setIcon(IconManager::instance().loadIcon("go-first"));
-	backButton->setIcon(IconManager::instance().loadIcon("go-previous"));
-	forwardButton->setIcon(IconManager::instance().loadIcon("go-next"));
-	lastButton->setIcon(IconManager::instance().loadIcon("go-last"));
-
 	startButton->setFocusPolicy(Qt::NoFocus);
 	backButton->setFocusPolicy(Qt::NoFocus);
 	forwardButton->setFocusPolicy(Qt::NoFocus);
@@ -206,6 +201,12 @@
 
 void PageSelector::iconSetChange()
 {
+	IconManager& iconManager = IconManager::instance();
+	startButton->setIcon(iconManager.loadIcon("go-first"));
+	backButton->setIcon(iconManager.loadIcon("go-previous"));
+	forwardButton->setIcon(iconManager.loadIcon("go-next"));
+	lastButton->setIcon(iconManager.loadIcon("go-last"));
+
 	QByteArray stylesheet;
 	if (loadRawText(ScPaths::instance().libDir() + "scribus.css", stylesheet))
 	{

qirat

2026-09-10 06:54

reporter   ~0054451

Thanks. Work. Although I would not call it "styled for the previous theme" as in new title. Neither Light nor Dark actually has blue tab-title background.

Issue History

Date Modified Username Field Change
2026-08-16 06:33 qirat New Issue
2026-08-16 06:33 qirat File Added: dark-theme-live-toggle-stale-dock-stylesheet-fix-v1.02.patch
2026-08-16 06:33 qirat File Added: live-theme-toggle-blue-bg1.png
2026-08-16 06:33 qirat File Added: live-theme-toggle-blue-bg2.png
2026-08-29 03:29 qirat Note Added: 0054366
2026-08-29 03:29 qirat File Added: 4_dark-theme-live-toggle-stale-dock-stylesheet-fix-v1.07.patch
2026-08-29 05:26 qirat Tag Attached: #please_test
2026-08-29 10:19 qirat Note Added: 0054369
2026-08-29 10:19 qirat File Added: 4_dark-theme-live-toggle-stale-dock-stylesheet-fix-v1.08.patch
2026-09-08 21:55 jghali Summary [PATCH] Dark theme: dock tabs get blue active-tab BG after live toggle => [PATCH] Dark theme: switching theme leaves dock panel tabs styled for the previous theme
2026-09-08 21:58 jghali Assigned To => jghali
2026-09-08 21:58 jghali Status new => resolved
2026-09-08 21:58 jghali Resolution open => fixed
2026-09-08 21:58 jghali Fixed in Version => 1.7.4.svn
2026-09-10 06:54 qirat Note Added: 0054451