Avoid extensive string lookup in QSignalSpy.

Change-Id: Ie676ad36033e2f8d9832313956cfde9179967483
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
Jędrzej Nowacki 2014-06-25 10:39:41 +02:00
parent 8429c6a5a2
commit 35c7c3708f

View File

@ -176,10 +176,9 @@ private:
void initArgs(const QMetaMethod &member, const QObject *obj) void initArgs(const QMetaMethod &member, const QObject *obj)
{ {
const QList<QByteArray> params = member.parameterTypes(); args.reserve(member.parameterCount());
args.reserve(params.size()); for (int i = 0; i < member.parameterCount(); ++i) {
for (int i = 0; i < params.count(); ++i) { int tp = member.parameterType(i);
int tp = QMetaType::type(params.at(i).constData());
if (tp == QMetaType::UnknownType && obj) { if (tp == QMetaType::UnknownType && obj) {
void *argv[] = { &tp, &i }; void *argv[] = { &tp, &i };
QMetaObject::metacall(const_cast<QObject*>(obj), QMetaObject::metacall(const_cast<QObject*>(obj),
@ -191,7 +190,7 @@ private:
if (tp == QMetaType::UnknownType) { if (tp == QMetaType::UnknownType) {
Q_ASSERT(tp != QMetaType::Void); // void parameter => metaobject is corrupt Q_ASSERT(tp != QMetaType::Void); // void parameter => metaobject is corrupt
qWarning("Don't know how to handle '%s', use qRegisterMetaType to register it.", qWarning("Don't know how to handle '%s', use qRegisterMetaType to register it.",
params.at(i).constData()); member.parameterNames().at(i).constData());
} }
args << tp; args << tp;
} }