[vlc-commits] [Git][videolan/vlc][master] qt: synchronize the color schemes with Qt 6.8.0
Steve Lhomme (@robUx4)
gitlab at videolan.org
Mon Oct 14 19:05:31 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
8df355a2 by Fatih Uzunoglu at 2024-10-14T18:53:18+00:00
qt: synchronize the color schemes with Qt 6.8.0
Qt finally provides the ability to change the color
scheme. Although the default palette colors are
rarely used in Qt Quick, this is still an important
thing for the platform plugin.
This means that if the user opts in to a specific
scheme, things such as platform menus, windows,
window frames would adapt to the overridden scheme
rather than using the setting inherited from the
system.
- - - - -
1 changed file:
- modules/gui/qt/maininterface/mainctx.cpp
Changes:
=====================================
modules/gui/qt/maininterface/mainctx.cpp
=====================================
@@ -71,6 +71,10 @@
#include <QOperatingSystemVersion>
+#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
+#include <QStyleHints>
+#endif
+
#ifdef _WIN32
#include <QFileInfo>
#endif
@@ -136,6 +140,31 @@ MainCtx::MainCtx(qt_intf_t *_p_intf)
settings = getSettings();
m_colorScheme = new ColorSchemeModel(this);
+#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
+ connect(m_colorScheme, &ColorSchemeModel::currentChanged, qGuiApp, [colorScheme = m_colorScheme]() {
+ QStyleHints *const styleHints = qGuiApp->styleHints();
+ if (unlikely(!styleHints))
+ return;
+
+ Qt::ColorScheme scheme;
+ switch (colorScheme->currentScheme())
+ {
+ case ColorSchemeModel::ColorScheme::Day:
+ scheme = Qt::ColorScheme::Light;
+ break;
+ case ColorSchemeModel::ColorScheme::Night:
+ scheme = Qt::ColorScheme::Dark;
+ break;
+ case ColorSchemeModel::ColorScheme::System:
+ default:
+ styleHints->unsetColorScheme();
+ return;
+ }
+
+ styleHints->setColorScheme(scheme);
+ });
+#endif
+
m_sort = new SortCtx(this);
m_search = new SearchCtx(this);
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/8df355a2b4ad75b08ab256941ce2bcadab6ed4c3
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/8df355a2b4ad75b08ab256941ce2bcadab6ed4c3
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list