QSignalSpy: inline verify(obj, func) into the only caller

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 <marten.nordheim@qt.io>
This commit is contained in:
Marc Mutz 2024-03-20 17:21:52 +01:00
parent da51b957c0
commit b4c5887939

View File

@ -62,18 +62,7 @@ public:
#else
template <typename Func>
QSignalSpy(const typename QtPrivate::FunctionPointer<Func>::Object *obj, Func signal0)
: QSignalSpy(verify(obj, signal0)) {}
private:
template <typename Func>
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)