From 4b6ecd79534527090bc935152572f94798854511 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 8 Nov 2020 07:04:55 +0200 Subject: [PATCH] make use of QStyle::objectName() in QApplicationPrivate::x11_apply_settings() Signed-off-by: Ivailo Monev --- src/gui/kernel/qapplication.cpp | 5 ++--- src/gui/kernel/qapplication_x11.cpp | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 6041434c8..b563fa799 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -1045,9 +1045,8 @@ QStyle *QApplication::style() QStyle *&app_style = QApplicationPrivate::app_style; app_style = QStyleFactory::create(style); if (!app_style) { - QStringList styles = QStyleFactory::keys(); - for (int i = 0; i < styles.size(); ++i) { - if ((app_style = QStyleFactory::create(styles.at(i)))) + foreach (const QString &style, QStyleFactory::keys()) { + if ((app_style = QStyleFactory::create(style))) break; } } diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 1a6abb095..8809857a8 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -692,13 +692,11 @@ bool QApplicationPrivate::x11_apply_settings() stylename = qt_guiPlatformPlugin()->styleName(); } - static QString currentStyleName = stylename; if (QCoreApplication::startingUp()) { if (!stylename.isEmpty() && QApplicationPrivate::styleOverride.isNull()) QApplicationPrivate::styleOverride = stylename; } else { - if (currentStyleName != stylename) { - currentStyleName = stylename; + if (QApplication::style()->objectName() != stylename) { QApplication::setStyle(stylename); } } -- 2.11.0