[LyX/2.5.x] Enable dark/light mode pref on Linuy as well

Juergen Spitzmueller spitz at lyx.org
Mon Feb 23 08:04:05 UTC 2026


commit 4d0a375c289bf672523b63afa879b7eddb3cfd55
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Tue Dec 30 12:14:09 2025 +0100

    Enable dark/light mode pref on Linuy as well
    
    This is supported at least for QT_QPA_PLATFORMTHEME=gtk3
    
    The KDE platform theme does not support this yet
    (https://bugs.kde.org/show_bug.cgi?id=509488)
    so expand the tooltip
    
    (cherry picked from commit 7d6876e86d4952e69e668f83171d24b924b273fa)
---
 src/frontends/qt/GuiApplication.cpp |  2 +-
 src/frontends/qt/GuiPrefs.cpp       | 10 +++++-----
 src/frontends/qt/ui/PrefUi.ui       |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp
index 96651a551f..27afd714d6 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -1280,7 +1280,7 @@ void Application::applyPrefs()
 		return;
 	if (lyxrc.ui_style != "default")
 		lyx::frontend::GuiApplication::setStyle(toqstr(lyxrc.ui_style));
-#if (defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN) || defined(Q_OS_MAC)) && QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
+#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
 	// Set color scheme from prefs
 	if (lyxrc.color_scheme == "dark")
 		guiApp->styleHints()->setColorScheme(Qt::ColorScheme::Dark);
diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index 4c3cb6b4ef..787133507a 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -64,7 +64,7 @@
 #include <QShortcut>
 #include <QString>
 #include <QStyleFactory>
-#if (defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN) || defined(Q_OS_MAC)) && QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
+#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
 #include <QStyleHints>
 #endif
 #include <QTreeWidget>
@@ -3410,7 +3410,7 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form)
 		this, SIGNAL(changed()));
 	connect(uiStyleCO, SIGNAL(activated(int)),
 		this, SIGNAL(changed()));
-#if (defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN) || defined(Q_OS_MAC)) && QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
+#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
 	connect(colorSchemeCO, SIGNAL(activated(int)),
 		this, SIGNAL(changed()));
 #endif
@@ -3437,7 +3437,7 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form)
 	iconSetCO->addItem(qt_("Classic"), "classic");
 	iconSetCO->addItem(qt_("Oxygen"), "oxygen");
 
-#if (defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN) || defined(Q_OS_MAC)) && QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
+#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
 	colorSchemeCO->addItem(qt_("System Default"), "system");
 	colorSchemeCO->addItem(qt_("Light Mode"), "light");
 	colorSchemeCO->addItem(qt_("Dark Mode"), "dark");
@@ -3476,7 +3476,7 @@ void PrefUserInterface::applyRC(LyXRC & rc) const
 		else
 			frontend::GuiApplication::setStyle(uistyle);
 	}
-#if (defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN) || defined(Q_OS_MAC)) && QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
+#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
 	QString const color_scheme = colorSchemeCO->itemData(
 		colorSchemeCO->currentIndex()).toString();
 	if (rc.color_scheme != fromqstr(color_scheme)) {
@@ -3524,7 +3524,7 @@ void PrefUserInterface::updateRC(LyXRC const & rc)
 	toggleToolbarsCB->setChecked(rc.full_screen_toolbars);
 	toggleTabbarCB->setChecked(rc.full_screen_tabbar);
 	toggleMenubarCB->setChecked(rc.full_screen_menubar);
-#if (defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN) || defined(Q_OS_MAC)) && QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
+#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
 	int colorscheme = colorSchemeCO->findData(toqstr(rc.color_scheme));
 	if (colorscheme < 0)
 		colorscheme = 0;
diff --git a/src/frontends/qt/ui/PrefUi.ui b/src/frontends/qt/ui/PrefUi.ui
index 18be0ac1b5..d1f7d00fe3 100644
--- a/src/frontends/qt/ui/PrefUi.ui
+++ b/src/frontends/qt/ui/PrefUi.ui
@@ -115,7 +115,7 @@
         <item row="3" column="1">
          <widget class="QComboBox" name="colorSchemeCO">
           <property name="toolTip">
-           <string>You can override the system's color scheme here if the selected style supports multiple schemes.</string>
+           <string>You can override the system's color scheme here if the selected style supports multiple schemes and the platform theme supports mode switching.</string>
           </property>
           <property name="inputMethodHints">
            <set>Qt::ImhFormattedNumbersOnly|Qt::ImhLatinOnly</set>


More information about the lyx-cvs mailing list