From 2acd212acc6fdabcb88b9c9b999609d35941081f Mon Sep 17 00:00:00 2001 From: Doris Verria Date: Tue, 27 Sep 2022 17:56:50 +0200 Subject: [PATCH] QGuiApp: Set QStyleHints's appearance based on platform theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QStyleHintsPrivate::setAppearance was only called when the theme changes, and up until then the reported QStyleHints::appearance() was Unknown. To fix, the QGuiApplication should set the appearance once the platform theme is created. Change-Id: I5353031628d1f1a8b1e23bed0b2fb0bc0622cbe8 Reviewed-by: Tor Arne Vestbø Reviewed-by: Axel Spoerl --- src/gui/kernel/qguiapplication.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index f89043fbc6..ec5a9d3710 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1469,6 +1469,8 @@ void QGuiApplicationPrivate::createPlatformIntegration() Q_UNUSED(platformExplicitlySelected); init_platform(QLatin1StringView(platformName), platformPluginPath, platformThemeName, argc, argv); + if (const QPlatformTheme *theme = platformTheme()) + QStyleHintsPrivate::get(QGuiApplication::styleHints())->setAppearance(theme->appearance()); if (!icon.isEmpty()) forcedWindowIcon = QDir::isAbsolutePath(icon) ? QIcon(icon) : QIcon::fromTheme(icon);