View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0017988 | Scribus | OS-MacOSX | public | 2026-10-01 03:04 | 2026-10-01 03:04 |
| Reporter | jaca101 | Assigned To | |||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | new | Resolution | open | ||
| Platform | MacBook Pro M1 | OS | MacOS Tahoe 26.6.2 | OS Version | 26.6.2 (25G83) |
| Product Version | 1.7.4.svn | ||||
| Summary | 0017988: macOS: switching system appearance (light/dark) while Scribus runs leaves dock tabs, canvas background, page grid and MDI title | ||||
| Description | With the UI theme set to "auto", switching the macOS system appearance between light and dark while Scribus is running leaves several parts of the UI styled for the previous theme: - Active dock tabs (Arrange Pages, Properties...) are grey in dark mode and blend into the tab bar in light mode: the ADS bundled stylesheet ends up applied instead of the Scribus one. - The canvas background around the page (scratch space) and the page grid in the Arrange Pages palette stay dark after switching to light (and vice versa). - After starting in dark mode and switching to light, the document (MDI subwindow) title bar stays dark. Starting Scribus directly in either mode looks correct; only switching while running is affected. 0017926 and 0017952 fixed the same symptoms when the theme is changed from Preferences, but not when the change comes from the system. Root causes (checked against Qt 6.11.2 sources): 1. ScribusProxyStyle::eventFilter() returns true for every QEvent::ThemeChange sent to qApp. In Qt 6, processThemeChanged() sends ThemeChange only to qApp, and QGuiApplication::event() forwards it to every window, which is how widgets get re-polished. Consuming it means widgets are never notified (verified with a trace: 0 deliveries before, 4 per switch after). 2. Qt emits QStyleHints::colorSchemeChanged before it updates the application palette. The workaround in initScMW() reapplies the Scribus stylesheet from that signal, i.e. with the old palette. ApplicationPaletteChange then reaches the top-level main window as a posted event, and the ADS dock manager's filter on that window reloads ADS's stylesheet over ours. (Queueing the reapply from colorSchemeChanged is not enough: it still runs before ADS.) 3. When setApplicationTheme() runs from the ThemeChange filter, the palette has already been replaced, so the old Window colour is gone and the default scratch colour can no longer be recognised; nothing repaints the views or the page grid either. QMdiSubWindow also caches its title bar palette on PaletteChange. Patches attached (against trunk r27875, apply in order): - 0004: let ThemeChange propagate (keep the "auto" handling). - 0005: reapply the Scribus stylesheet from ScribusMainWindow::changeEvent(PaletteChange), queued; that event arrives right after ADS has processed ApplicationPaletteChange. Skipped until initScMW() has created the styled widgets (the splash screen processes events earlier). - 0006 (needs 0005): in the same handler, let a scratch colour that matched the previous palette Window colour follow the new one and repaint the page grid and document views, as slotPrefsOrg() does (custom colours untouched); resend PaletteChange to each QMdiSubWindow so its title bar palette is refreshed. | ||||
| Steps To Reproduce | 1. Preferences > User Interface: theme palette "auto" (default). 2. Set macOS System Settings > Appearance to Dark and start Scribus; open a document. 3. With Scribus running, switch Appearance to Light. -> Canvas background around the page, page grid in Arrange Pages and the document title bar stay dark. 4. Switch Appearance back to Dark. -> Active dock tabs (Arrange Pages, Properties) are grey instead of dark. | ||||
| Additional Information | Environment: macOS 26.6 (Tahoe), Apple Silicon, Qt 6.11.2 (Homebrew), Scribus 1.7.4.svn trunk r27875 built with CMake + Ninja. Verified with the patches applied: started both in dark and in light mode and switched both ways; dock tabs, scratch space, page grid and title bar follow the theme, CPU stays idle (no refresh loop). Not covered: a scratch colour saved in dark mode is still used if the next session starts in light mode (no previous palette to compare with at startup). The patches were prepared with AI assistance (Claude Code) and reviewed and tested by me; they carry a Co-Authored-By trailer. | ||||
| Tags | No tags attached. | ||||
| Attached Files | 0004-ScribusProxyStyle-don-t-swallow-QEvent-ThemeChange-o.patch (1,968 bytes)
From ef54f579eca9305e8e8eb680a899838718fb0259 Mon Sep 17 00:00:00 2001
From: Satoshi Nakamoto <satoshi.nakamoto.xdos@proton.me>
Date: Thu, 1 Oct 2026 03:56:20 +0200
Subject: [PATCH 4/9] ScribusProxyStyle: don't swallow QEvent::ThemeChange on
qApp
The application event filter returned true for every ThemeChange sent to
qApp. In Qt 6, QGuiApplicationPrivate::processThemeChanged() sends
ThemeChange only to qApp, and QGuiApplication::event() forwards it to
the style hints and to every window; QWidgetWindow then passes it to its
widget, whose QWidget::event() re-polishes it and sends StyleChange.
Consuming the event therefore stopped widgets from ever being notified of
a system or Scribus-initiated theme change.
Keep the Scribus handling (follow the system palette in "auto" mode) but
let the event propagate. Verified on macOS: with this change the main
window receives ThemeChange on every light/dark switch; before it never
did. No visual difference was observed on macOS, where existing
stylesheet workarounds already cover most widgets.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---
scribus/ui/factories/scribusproxystyle.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scribus/ui/factories/scribusproxystyle.cpp b/scribus/ui/factories/scribusproxystyle.cpp
index bb74ce73f..b47d8f120 100644
--- a/scribus/ui/factories/scribusproxystyle.cpp
+++ b/scribus/ui/factories/scribusproxystyle.cpp
@@ -243,8 +243,8 @@ bool ScribusProxyStyle::eventFilter(QObject *object, QEvent *event)
{
if (PrefsManager::instance().appPrefs.uiPrefs.stylePalette == "auto" && !blockRefresh)
setApplicationTheme(ScribusProxyStyle::ApplicationTheme::System);
-
- return true;
+ // Don't consume the event: QGuiApplication forwards ThemeChange from qApp to every
+ // window, which is how widgets get re-polished and repainted for the new theme.
}
return QObject::eventFilter(object, event);
--
2.54.0 (Apple Git-157)
0005-Reapply-the-Scribus-stylesheet-after-a-palette-chang.patch (2,431 bytes)
From 8de14fe509632fa6f340674391a3d4b824da0a03 Mon Sep 17 00:00:00 2001
From: Satoshi Nakamoto <satoshi.nakamoto.xdos@proton.me>
Date: Thu, 1 Oct 2026 04:07:13 +0200
Subject: [PATCH 5/9] Reapply the Scribus stylesheet after a palette change,
once ADS is done
When the system switches between light and dark mode, Qt emits
QStyleHints::colorSchemeChanged before it updates the application palette
(QGuiApplicationPrivate::handleThemeChanged). The existing workaround
reapplied the Scribus stylesheet from that signal, i.e. with the old
palette. ApplicationPaletteChange then reaches the main window as a
posted event, and the ADS dock manager's event filter on that window
reloads ADS's bundled stylesheet over the Scribus one. Result: after a
system theme switch, active dock tabs kept ADS styling (grey tabs in dark
mode) instead of the Scribus stylesheet.
The main window receives its PaletteChange right after that
ApplicationPaletteChange has gone through the ADS filter. Reapply the
Scribus stylesheet from there, queued, so it wins over ADS and is built
from the new palette. The call is skipped until initScMW() has created
the styled widgets, since the splash screen processes events earlier.
Verified on macOS 26 by switching system appearance dark -> light ->
dark: active dock tabs now match the startup styling in both modes, and
CPU stays idle (no refresh loop).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---
scribus/scribus.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/scribus/scribus.cpp b/scribus/scribus.cpp
index d88956947..9061e3198 100644
--- a/scribus/scribus.cpp
+++ b/scribus/scribus.cpp
@@ -1930,7 +1930,15 @@ void ScribusMainWindow::changeEvent(QEvent *e)
if (e->type() == QEvent::LanguageChange)
languageChange();
else
+ {
+ // The main window gets its PaletteChange after the ApplicationPaletteChange that makes
+ // ADS reload its bundled stylesheet over ours, so reapply ours, with the new palette.
+ // Checked when run: the splash screen can process events before initScMW() has created
+ // the widgets setStyleSheet() styles, viewToolBar being the last of them.
+ if (e->type() == QEvent::PaletteChange)
+ QMetaObject::invokeMethod(this, [this]() { if (dockManager && viewToolBar) setStyleSheet(); }, Qt::QueuedConnection);
QMainWindow::changeEvent(e);
+ }
}
void ScribusMainWindow::closeEvent(QCloseEvent *ce)
--
2.54.0 (Apple Git-157)
0006-Follow-system-theme-changes-with-the-default-scratch.patch (4,928 bytes)
From dcb8143f34df171965dc9527416a12e1972966cf Mon Sep 17 00:00:00 2001
From: Satoshi Nakamoto <satoshi.nakamoto.xdos@proton.me>
Date: Thu, 1 Oct 2026 04:31:03 +0200
Subject: [PATCH 6/9] Follow system theme changes with the default scratch
space color
The scratch space color (canvas background and the page palette grid)
defaults to the palette Window color. #17952 made it follow a theme set
in Preferences, but a system light/dark switch in "auto" mode left it on
the previous theme: by the time ScribusProxyStyle::setApplicationTheme()
runs from the ThemeChange filter, Qt has already replaced the palette, so
the old Window color is no longer available to recognise the default,
and nothing repaints the views or the page grid.
In the main window's PaletteChange handler, remember the previous Window
color; if the scratch color still matches it (or already matches the new
one), switch it to the new Window color and repaint the page grid and the
document views, as slotPrefsOrg() does. A custom scratch color is left
alone.
Also resend PaletteChange to each QMdiSubWindow there: it caches its
title bar palette on PaletteChange, and after starting in dark mode and
switching to light the document title bar otherwise stayed dark.
Verified on macOS 26 starting in dark and in light mode and switching
both ways: canvas background, page grid and document title bar follow
the theme, CPU stays idle.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---
scribus/scribus.cpp | 46 +++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 44 insertions(+), 2 deletions(-)
diff --git a/scribus/scribus.cpp b/scribus/scribus.cpp
index 9061e3198..f795af563 100644
--- a/scribus/scribus.cpp
+++ b/scribus/scribus.cpp
@@ -305,6 +305,10 @@ bool previewDinUse;
bool printDinUse;
extern bool emergencyActivated;
+// Window color of the application palette last seen by the main window. A scratch space color
+// equal to it is the theme default and follows palette changes.
+static QColor lastPaletteWindowColor;
+
ScribusMainWindow::ScribusMainWindow() :
m_documentLogManager(DocumentLogManager::instance()),
m_prefsManager(PrefsManager::instance()),
@@ -494,6 +498,7 @@ int ScribusMainWindow::initScMW(bool primaryMainWindow)
ScQApp->changeLabelVisibility(m_prefsManager.appPrefs.uiPrefs.showLabels);
setStyleSheet();
+ lastPaletteWindowColor = QApplication::palette().color(QPalette::Active, QPalette::Window);
connect(QGuiApplication::styleHints(), &QStyleHints::colorSchemeChanged, this, [this]()
{
@@ -1934,9 +1939,46 @@ void ScribusMainWindow::changeEvent(QEvent *e)
// The main window gets its PaletteChange after the ApplicationPaletteChange that makes
// ADS reload its bundled stylesheet over ours, so reapply ours, with the new palette.
// Checked when run: the splash screen can process events before initScMW() has created
- // the widgets setStyleSheet() styles, viewToolBar being the last of them.
+ // the widgets used below, pagePalette (set in initPalettes()) being the last of them.
if (e->type() == QEvent::PaletteChange)
- QMetaObject::invokeMethod(this, [this]() { if (dockManager && viewToolBar) setStyleSheet(); }, Qt::QueuedConnection);
+ QMetaObject::invokeMethod(this, [this]() {
+ if (!dockManager || !viewToolBar || !pagePalette)
+ return;
+ setStyleSheet();
+
+ // QMdiSubWindow caches its title bar palette when it gets PaletteChange; after a
+ // system theme switch that cache can keep the previous theme, so refresh it.
+ const QList<QMdiSubWindow *> subWindows = mdiArea->subWindowList();
+ for (QMdiSubWindow* subWindow : subWindows)
+ {
+ QEvent paletteChange(QEvent::PaletteChange);
+ QCoreApplication::sendEvent(subWindow, &paletteChange);
+ subWindow->update();
+ }
+
+ // Let the default scratch space color follow the theme. slotPrefsOrg() handles a theme
+ // set in Preferences, but a system theme change in "auto" mode only arrives here.
+ const QColor windowColor = QApplication::palette().color(QPalette::Active, QPalette::Window);
+ if (windowColor == lastPaletteWindowColor)
+ return;
+ QColor& scratchColor = m_prefsManager.appPrefs.displayPrefs.scratchColor;
+ const bool followsTheme = (scratchColor == lastPaletteWindowColor || scratchColor == windowColor);
+ lastPaletteWindowColor = windowColor;
+ if (!followsTheme)
+ return;
+ scratchColor = windowColor;
+ pagePalette->updatePageGrid();
+ for (QMdiSubWindow* subWindow : subWindows)
+ {
+ ScribusWin* scw = dynamic_cast<ScribusWin *>(subWindow->widget());
+ if (!scw)
+ continue;
+ QPalette viewPalette = scw->view()->palette();
+ viewPalette.setBrush(QPalette::Window, scratchColor);
+ scw->view()->setPalette(viewPalette);
+ scw->view()->DrawNew();
+ }
+ }, Qt::QueuedConnection);
QMainWindow::changeEvent(e);
}
}
--
2.54.0 (Apple Git-157)
| ||||
| Patch | Yes | ||||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2026-10-01 03:04 | jaca101 | New Issue | |
| 2026-10-01 03:04 | jaca101 | File Added: 0004-ScribusProxyStyle-don-t-swallow-QEvent-ThemeChange-o.patch | |
| 2026-10-01 03:04 | jaca101 | File Added: 0005-Reapply-the-Scribus-stylesheet-after-a-palette-chang.patch | |
| 2026-10-01 03:04 | jaca101 | File Added: 0006-Follow-system-theme-changes-with-the-default-scratch.patch |