summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextformat.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2016-11-10 12:45:49 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-11-10 16:14:51 +0000
commit467b15a20c3d6eb611ea5f6ccffd5fc0df81b0c4 (patch)
tree1bff11fa019cebd2242c856301b7bd28462a9f6c /src/gui/text/qtextformat.cpp
parent5cff7d2b679d48a247b4630cb9e3d5b04fab0b55 (diff)
Improve use of QHash to minimize double hashing
Avoid looking up by key twice in a row in various locations, but instead using iterators and index lookup. Change-Id: I61a079115199ab9c041ad3a26d36b45ee3f775e0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui/text/qtextformat.cpp')
-rw-r--r--src/gui/text/qtextformat.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 8adeb3e659..39fec032dc 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -3409,8 +3409,7 @@ int QTextFormatCollection::indexForFormat(const QTextFormat &format)
f.d = new QTextFormatPrivate;
f.d->resolveFont(defaultFnt);
- if (!hashes.contains(hash, idx))
- hashes.insert(hash, idx);
+ hashes.insert(hash, idx);
} QT_CATCH(...) {
formats.pop_back();