diff options
author | Christian Kamm <christian.d.kamm@nokia.com> | 2010-07-06 10:20:24 (GMT) |
---|---|---|
committer | Christian Kamm <christian.d.kamm@nokia.com> | 2010-07-06 10:20:24 (GMT) |
commit | f62f6effab8d1551d8e5e5843dc478addee96de1 (patch) | |
tree | 1d47256a1ad69d967b2c4227dfdd15207d195cf0 /src/gui/text/qtextdocument_p.h | |
parent | 7e35c6ff442e237ff9a1bec9ea1cdfb597d9ceae (diff) | |
download | Qt-f62f6effab8d1551d8e5e5843dc478addee96de1.zip Qt-f62f6effab8d1551d8e5e5843dc478addee96de1.tar.gz Qt-f62f6effab8d1551d8e5e5843dc478addee96de1.tar.bz2 |
Fix performance of QTextDocumentPrivate::adjustDocumentChangesAndCursors
As the changedCursors list grew large, the function used to spend an
extraordinate amount of time in QList::contains.
The fix removes the changedCursors list outright and replaces it with a
flag in QTextCursorPrivate.
Done-with: mae
Diffstat (limited to 'src/gui/text/qtextdocument_p.h')
-rw-r--r-- | src/gui/text/qtextdocument_p.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h index 06e0753..dcac99d 100644 --- a/src/gui/text/qtextdocument_p.h +++ b/src/gui/text/qtextdocument_p.h @@ -277,7 +277,7 @@ public: void documentChange(int from, int length); inline void addCursor(QTextCursorPrivate *c) { cursors.append(c); } - inline void removeCursor(QTextCursorPrivate *c) { cursors.removeAll(c); changedCursors.removeAll(c); } + inline void removeCursor(QTextCursorPrivate *c) { cursors.removeAll(c); } QTextFrame *frameAt(int pos) const; QTextFrame *rootFrame() const; @@ -329,8 +329,7 @@ private: BlockMap blocks; int initialBlockCharFormatIndex; - QList<QTextCursorPrivate*> cursors; - QList<QTextCursorPrivate*> changedCursors; + QList<QTextCursorPrivate *> cursors; QMap<int, QTextObject *> objects; QMap<QUrl, QVariant> resources; QMap<QUrl, QVariant> cachedResources; |