commit 7d6876e86d4952e69e668f83171d24b924b273fa
Author: Juergen Spitzmueller <[email protected]>
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
---
src/frontends/qt/GuiApplication.cpp | 2 +-
src/frontends/qt/GuiPrefs.cpp | 13 +++++++------
src/frontends/qt/ui/PrefUi.ui | 2 +-
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/frontends/qt/GuiApplication.cpp
b/src/frontends/qt/GuiApplication.cpp
index c1f972ebc3..4ff41bd9f2 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -1276,7 +1276,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 7ed0681740..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)) {
@@ -3488,7 +3488,8 @@ void PrefUserInterface::applyRC(LyXRC & rc) const
guiApp->styleHints()->unsetColorScheme();
// make the application update the palette
QPalette currentPalette = guiApp->palette();
- guiApp->setPalette(cur }
+ guiApp->setPalette(currentPalette);
+ }
rc.color_scheme = fromqstr(color_scheme);
#endif
@@ -3523,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>
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs