From 35c7c3708f89799e99ca6fae5804df0e422f0ac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Wed, 25 Jun 2014 10:39:41 +0200 Subject: [PATCH] Avoid extensive string lookup in QSignalSpy. Change-Id: Ie676ad36033e2f8d9832313956cfde9179967483 Reviewed-by: Olivier Goffart --- src/testlib/qsignalspy.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/testlib/qsignalspy.h b/src/testlib/qsignalspy.h index a8a776aff0..489fc28736 100644 --- a/src/testlib/qsignalspy.h +++ b/src/testlib/qsignalspy.h @@ -176,10 +176,9 @@ private: void initArgs(const QMetaMethod &member, const QObject *obj) { - const QList params = member.parameterTypes(); - args.reserve(params.size()); - for (int i = 0; i < params.count(); ++i) { - int tp = QMetaType::type(params.at(i).constData()); + args.reserve(member.parameterCount()); + for (int i = 0; i < member.parameterCount(); ++i) { + int tp = member.parameterType(i); if (tp == QMetaType::UnknownType && obj) { void *argv[] = { &tp, &i }; QMetaObject::metacall(const_cast(obj), @@ -191,7 +190,7 @@ private: if (tp == QMetaType::UnknownType) { Q_ASSERT(tp != QMetaType::Void); // void parameter => metaobject is corrupt qWarning("Don't know how to handle '%s', use qRegisterMetaType to register it.", - params.at(i).constData()); + member.parameterNames().at(i).constData()); } args << tp; }