QGuiApp: Set QStyleHints's appearance based on platform theme

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ø <tor.arne.vestbo@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
bb10
Doris Verria 2022-09-27 17:56:50 +02:00
parent abbd9c91f5
commit 2acd212acc
1 changed files with 2 additions and 0 deletions

View File

@ -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);