diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-01-26 14:38:54 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-02-11 23:18:39 +0000 |
commit | 37a933c2b14a4a1aad54af0eba0bc210ae5b549a (patch) | |
tree | 04c4d7f34b23a5e5f3de09adfc900ebf7f700103 /src/gui/kernel/qguiapplication.cpp | |
parent | d09cfe04b82c1bd0738bca24def1e9c3bfdaaa4b (diff) |
QtGui: eradicate Q_FOREACH loops [needing qAsConst()]
... by replacing them with C++11 range-for loops.
To avoid detaches of these mutable Qt containers,
wrap the container in qAsConst().
Change-Id: I90fd517ad542ef92034403c15ebb8300a56ac693
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/gui/kernel/qguiapplication.cpp')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 632fe874a6..9b64c32533 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -990,9 +990,8 @@ qreal QGuiApplication::devicePixelRatio() const } topDevicePixelRatio = 1.0; // make sure we never return 0. - foreach (QScreen *screen, QGuiApplicationPrivate::screen_list) { + for (QScreen *screen : qAsConst(QGuiApplicationPrivate::screen_list)) topDevicePixelRatio = qMax(topDevicePixelRatio, screen->devicePixelRatio()); - } return topDevicePixelRatio; } @@ -1127,7 +1126,7 @@ static void init_platform(const QString &pluginArgument, const QString &platform // 2) Ask the platform integration for a list of theme names themeNames += QGuiApplicationPrivate::platform_integration->themeNames(); // 3) Look for a theme plugin. - foreach (const QString &themeName, themeNames) { + for (const QString &themeName : qAsConst(themeNames)) { QGuiApplicationPrivate::platform_theme = QPlatformThemeFactory::create(themeName, platformPluginPath); if (QGuiApplicationPrivate::platform_theme) break; @@ -1136,7 +1135,7 @@ static void init_platform(const QString &pluginArgument, const QString &platform // 4) If no theme plugin was found ask the platform integration to // create a theme if (!QGuiApplicationPrivate::platform_theme) { - foreach (const QString &themeName, themeNames) { + for (const QString &themeName : qAsConst(themeNames)) { QGuiApplicationPrivate::platform_theme = QGuiApplicationPrivate::platform_integration->createPlatformTheme(themeName); if (QGuiApplicationPrivate::platform_theme) break; @@ -1153,7 +1152,7 @@ static void init_platform(const QString &pluginArgument, const QString &platform // boolean 'foo' or strings: 'foo=bar' if (!arguments.isEmpty()) { if (QObject *nativeInterface = QGuiApplicationPrivate::platform_integration->nativeInterface()) { - foreach (const QString &argument, arguments) { + for (const QString &argument : qAsConst(arguments)) { const int equalsPos = argument.indexOf(QLatin1Char('=')); const QByteArray name = equalsPos != -1 ? argument.left(equalsPos).toUtf8() : argument.toUtf8(); |