diff options
author | Alexis Menard <alexis.menard@nokia.com> | 2010-02-09 22:41:57 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@nokia.com> | 2010-02-09 22:58:22 (GMT) |
commit | b47306a53e7467ca5baf5bf49fa9da9229acd4c3 (patch) | |
tree | 67e069dc2e0f36789fb15c717ef0725b8e76c017 | |
parent | 969b61f508294d1f683e09e78641127d0f0def05 (diff) | |
download | Qt-b47306a53e7467ca5baf5bf49fa9da9229acd4c3.zip Qt-b47306a53e7467ca5baf5bf49fa9da9229acd4c3.tar.gz Qt-b47306a53e7467ca5baf5bf49fa9da9229acd4c3.tar.bz2 |
A little optimization in QTextControlPrivate::setContent.
-rw-r--r-- | src/gui/text/qtextcontrol.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index aaaa3ca..b42f95a 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -441,7 +441,6 @@ void QTextControlPrivate::setContent(Qt::TextFormat format, const QString &text, QObject::connect(doc, SIGNAL(documentLayoutChanged()), q, SLOT(_q_documentLayoutChanged())); // convenience signal forwards - QObject::connect(doc, SIGNAL(contentsChanged()), q, SIGNAL(textChanged())); QObject::connect(doc, SIGNAL(undoAvailable(bool)), q, SIGNAL(undoAvailable(bool))); QObject::connect(doc, SIGNAL(redoAvailable(bool)), q, SIGNAL(redoAvailable(bool))); QObject::connect(doc, SIGNAL(modificationChanged(bool)), q, SIGNAL(modificationChanged(bool))); @@ -452,8 +451,11 @@ void QTextControlPrivate::setContent(Qt::TextFormat format, const QString &text, if (!document) doc->setUndoRedoEnabled(false); + //Saving the index save some time. + static int contentsChangedIndex = QTextDocument::staticMetaObject.indexOfSignal("contentsChanged()"); + static int textChangedIndex = QTextControl::staticMetaObject.indexOfSignal("textChanged()"); // avoid multiple textChanged() signals being emitted - QObject::disconnect(doc, SIGNAL(contentsChanged()), q, SIGNAL(textChanged())); + QMetaObject::disconnect(doc, contentsChangedIndex, q, textChangedIndex); if (!text.isEmpty()) { // clear 'our' cursor for insertion to prevent @@ -488,7 +490,7 @@ void QTextControlPrivate::setContent(Qt::TextFormat format, const QString &text, } cursor.setCharFormat(charFormatForInsertion); - QObject::connect(doc, SIGNAL(contentsChanged()), q, SIGNAL(textChanged())); + QMetaObject::connect(doc, contentsChangedIndex, q, textChangedIndex); emit q->textChanged(); if (!document) doc->setUndoRedoEnabled(previousUndoRedoState); |