From b4c588793991b5aa7bf5ee99b5aabd7113af94b1 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 20 Mar 2024 17:21:52 +0100 Subject: [PATCH] QSignalSpy: inline verify(obj, func) into the only caller MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First, realize that we don't need the isObjectValid() call, because that's done by verify(QObject*,QMetaMethod) later. That leaves said fromSignal() and verify(QObject*, QMetaMethod) calls, which we can just inline into the (QObject*, Func) ctor, thus making said constructor SCARY, having extracted all template-independent code into other functions/ctors. Task-number: QTBUG-123544 Change-Id: I6b8afc541f75936045e2d28cfde51a34f98a1fdd Reviewed-by: MÃ¥rten Nordheim --- src/testlib/qsignalspy.h | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/testlib/qsignalspy.h b/src/testlib/qsignalspy.h index 82671c5eb11..6d09ec86953 100644 --- a/src/testlib/qsignalspy.h +++ b/src/testlib/qsignalspy.h @@ -62,18 +62,7 @@ public: #else template QSignalSpy(const typename QtPrivate::FunctionPointer::Object *obj, Func signal0) - : QSignalSpy(verify(obj, signal0)) {} - -private: - template - ObjectSignal verify(const QObject *obj, Func signal0) - { - if (!isObjectValid(obj)) - return {}; - - return verify(obj, QMetaMethod::fromSignal(signal0)); - } -public: + : QSignalSpy(verify(obj, QMetaMethod::fromSignal(signal0))) {} #endif // Q_QDOC QSignalSpy(const QObject *obj, QMetaMethod signal)