summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qstylesheetstyle.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2012-03-12 21:03:49 +0100
committerLars Knoll <lars.knoll@nokia.com>2012-03-12 21:03:49 +0100
commitd5098f2802255da10b749b93705084ad1fdfc6a5 (patch)
tree6462008a4ab7d13435d93490fed96c62c516cbdf /src/widgets/styles/qstylesheetstyle.cpp
parentd5a85940f785459d7b982d5fdf59a9fd18825092 (diff)
parentb5b41c18345719612e5411cc482466d2dbafdaf7 (diff)
Merge remote-tracking branch 'origin/master' into api_changes
Conflicts: tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp Change-Id: I884afc3b6d65c6411733a897a1949e19393573a7
Diffstat (limited to 'src/widgets/styles/qstylesheetstyle.cpp')
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 5c0ee254d4..7a0cc09452 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -2498,7 +2498,13 @@ void QStyleSheetStyle::setGeometry(QWidget *w)
void QStyleSheetStyle::setProperties(QWidget *w)
{
+ // we have two data structures here: a hash of property -> value for lookup,
+ // and a vector giving properties in the order they are specified.
+ //
+ // this means we only set a property once (thanks to the hash) but we set
+ // properties in the order they are specified.
QHash<QString, QVariant> propertyHash;
+ QVector<QString> properties;
QVector<Declaration> decls = declarations(styleRules(w), QString());
// run through the declarations in order
@@ -2535,10 +2541,17 @@ void QStyleSheetStyle::setProperties(QWidget *w)
#endif
default: v = decl.d->values.at(0).variant; break;
}
+
+ if (propertyHash.contains(property)) {
+ // we're ignoring the original appearance of this property
+ properties.remove(properties.indexOf(property));
+ }
+
propertyHash[property] = v;
+ properties.append(property);
}
- // apply the values
- const QList<QString> properties = propertyHash.keys();
+
+ // apply the values from left to right order
for (int i = 0; i < properties.count(); i++) {
const QString &property = properties.at(i);
w->setProperty(property.toLatin1(), propertyHash[property]);