Avoid string-based lookup of signals

Resolving signals by member function is preferable.

Change-Id: I2a47a27bc780c4c3c29cf472f9f063c910e20c18
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
bb10
Kent Hansen 2012-06-04 08:37:55 +02:00 committed by Qt by Nokia
parent 0915d073f1
commit 8a5a986828
1 changed files with 3 additions and 2 deletions

View File

@ -80,6 +80,7 @@
#include <qstyleoption.h>
#include <QtWidgets/qlineedit.h>
#include <QtGui/qaccessible.h>
#include <QtCore/qmetaobject.h>
#ifndef QT_NO_SHORTCUT
#include "private/qapplication_p.h"
@ -453,8 +454,8 @@ void QWidgetTextControlPrivate::setContent(Qt::TextFormat format, const QString
doc->setUndoRedoEnabled(false);
//Saving the index save some time.
static int contentsChangedIndex = QTextDocument::staticMetaObject.indexOfSignal("contentsChanged()");
static int textChangedIndex = QWidgetTextControl::staticMetaObject.indexOfSignal("textChanged()");
static int contentsChangedIndex = QMetaMethod::fromSignal(&QTextDocument::contentsChanged).methodIndex();
static int textChangedIndex = QMetaMethod::fromSignal(&QWidgetTextControl::textChanged).methodIndex();
// avoid multiple textChanged() signals being emitted
QMetaObject::disconnect(doc, contentsChangedIndex, q, textChangedIndex);