Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.8
-
None
Description
It gets told through portal. Before 6.8 portal wasn't inherited at all and was always returning Dark based on theme name (even though it's not really dark unless I enable dark theme switch as you could see). It seems it's because Qt asks portal but doesn't synchronize gtk state to the value. This should make it to still inherit portal by force applying dark colors to gtk theme when portal says so but always return the value based on actual colors so colorScheme is always synchronized to the visual state (what should also fix QTBUG-123031):
diff --git a/src/plugins/platformthemes/gtk3/qgtk3storage.cpp b/src/plugins/platformthemes/gtk3/qgtk3storage.cpp index 2991212d03..7356bae278 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3storage.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3storage.cpp @@ -364,14 +364,14 @@ void QGtk3Storage::populateMap() #if QT_CONFIG(dbus) // Prefer color scheme we get from xdg-desktop-portal as this is what GNOME // relies on these days - newColorScheme = m_portalInterface->colorScheme(); + g_object_set( + gtk_settings_get_default(), + "gtk-application-prefer-dark-theme", + gboolean(m_portalInterface->colorScheme() == Qt::ColorScheme::Dark), + nullptr); #endif - if (newColorScheme == Qt::ColorScheme::Unknown) { - // Derive color scheme from theme name - newColorScheme = newThemeName.contains("dark"_L1, Qt::CaseInsensitive) - ? Qt::ColorScheme::Dark : m_interface->colorSchemeByColors(); - } + newColorScheme = m_interface->colorSchemeByColors(); if (m_themeName == newThemeName && m_colorScheme == newColorScheme) return;
Attachments
Issue Links
- relates to
-
QTBUG-123031 Qt reports dark mode with light theme
-
- Reported
-
-
QTBUG-127028 QStyleHints::colorScheme doesn't match actual palette
-
- Reported
-
-
QTBUG-102458 better xdg-desktop-portal support
-
- Reported
-