summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qandroidstyle.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-01-26 19:45:58 +0100
committerMarc Mutz <marc.mutz@kdab.com>2016-04-25 05:11:35 +0000
commit83b2c97713211cca8f77c169adc1442edf963de3 (patch)
treeff6be576c27ae487f5829f31b72eadc2f5c5b7e7 /src/widgets/styles/qandroidstyle.cpp
parentbb71bd8de955806f11a596c23ab64baf2f368c42 (diff)
Android: don't iterate over .keys()
... iterate over the container itself instead. Avoids temporary QList creation as well as the lookup cost when actually calling value(key). Change-Id: I63a11e6f8f19919145ea142309ddbacd99c3bfc3 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/widgets/styles/qandroidstyle.cpp')
-rw-r--r--src/widgets/styles/qandroidstyle.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/widgets/styles/qandroidstyle.cpp b/src/widgets/styles/qandroidstyle.cpp
index fcab5eb5e6..743166549b 100644
--- a/src/widgets/styles/qandroidstyle.cpp
+++ b/src/widgets/styles/qandroidstyle.cpp
@@ -1234,8 +1234,9 @@ const QAndroidStyle::AndroidDrawable * QAndroidStyle::AndroidStateDrawable::best
int QAndroidStyle::AndroidStateDrawable::extractState(const QVariantMap &value)
{
QStyle::State state = QStyle::State_Enabled | QStyle::State_Active;;
- foreach (const QString &key, value.keys()) {
- bool val = value.value(key).toString() == QLatin1String("true");
+ for (auto it = value.cbegin(), end = value.cend(); it != end; ++it) {
+ const QString &key = it.key();
+ bool val = it.value().toString() == QLatin1String("true");
if (key == QLatin1String("enabled")) {
state.setFlag(QStyle::State_Enabled, val);
continue;