[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/libs/kotext/styles
From:       Jos van den Oever <jos () vandenoever ! info>
Date:       2010-08-10 10:45:52
Message-ID: 20100810104552.D0E16AC7E8 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1161556 by vandenoever:

Small speedup by using iterator.

 M  +12 -11    KoCharacterStyle.cpp  


--- trunk/koffice/libs/kotext/styles/KoCharacterStyle.cpp #1161555:1161556
@@ -234,21 +234,22 @@
 
 void KoCharacterStyle::unapplyStyle(QTextCharFormat &format) const
 {
-    QList<int> keys = d->stylesPrivate.keys();
-    for (int i = 0; i < keys.count(); i++) {
-        QVariant variant = d->stylesPrivate.value(keys[i]);
-        if (!variant.isNull()) {
-            if (variant == format.property(keys[i]))
-                format.clearProperty(keys[i]);
+    QMap<int, QVariant> props = d->stylesPrivate.properties();
+    QMap<int, QVariant>::const_iterator it = props.constBegin();
+    while (it != props.constEnd()) {
+        if (!it.value().isNull() && it.value() == format.property(it.key())) {
+           format.clearProperty(it.key());
         }
+        ++it;
     }
 
-    keys = d->hardCodedDefaultStyle.keys();
-    for (int i = 0; i < keys.count(); i++) {
-        QVariant variant = d->hardCodedDefaultStyle.value(keys.at(i));
-        if (!variant.isNull() && !format.hasProperty(keys.at(i))) {
-            format.setProperty(keys.at(i), variant);
+    props = d->hardCodedDefaultStyle.properties();
+    it = props.constBegin();
+    while (it != props.constEnd()) {
+        if (!it.value().isNull() && !format.hasProperty(it.key())) {
+            format.setProperty(it.key(), it.value());
         }
+        ++it;
     }
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic