Simplify connectSlotsByName() implementation

Use the new signal index-based API.

Change-Id: I89263f5366726ef8213e45e5ab6575ebd6eab04a
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
Kent Hansen 2012-05-31 20:38:40 +02:00 committed by Qt by Nokia
parent 98c7afb8d6
commit 3057c4173b

View File

@ -3210,16 +3210,11 @@ void QMetaObject::connectSlotsByName(QObject *o)
if (sigIndex < 0) { // search for compatible signals
const QMetaObject *smo = co->metaObject();
int slotlen = qstrlen(slot + len + 4) - 1;
for (int k = 0; k < smo->methodCount(); ++k) {
QMetaMethod method = smo->method(k);
if (method.methodType() != QMetaMethod::Signal)
continue;
for (int k = 0; k < QMetaObjectPrivate::absoluteSignalCount(smo); ++k) {
QMetaMethod method = QMetaObjectPrivate::signal(smo, k);
if (!qstrncmp(method.methodSignature().constData(), slot + len + 4, slotlen)) {
smeta = method.enclosingMetaObject();
int signalOffset, methodOffset;
computeOffsets(smeta, &signalOffset, &methodOffset);
sigIndex = k + - methodOffset + signalOffset;
sigIndex = k;
break;
}
}