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:
parent
da51b957c0
commit
b4c5887939
@ -62,18 +62,7 @@ public:
|
|||||||
#else
|
#else
|
||||||
template <typename Func>
|
template <typename Func>
|
||||||
QSignalSpy(const typename QtPrivate::FunctionPointer<Func>::Object *obj, Func signal0)
|
QSignalSpy(const typename QtPrivate::FunctionPointer<Func>::Object *obj, Func signal0)
|
||||||
: QSignalSpy(verify(obj, signal0)) {}
|
: QSignalSpy(verify(obj, QMetaMethod::fromSignal(signal0))) {}
|
||||||
|
|
||||||
private:
|
|
||||||
template <typename Func>
|
|
||||||
ObjectSignal verify(const QObject *obj, Func signal0)
|
|
||||||
{
|
|
||||||
if (!isObjectValid(obj))
|
|
||||||
return {};
|
|
||||||
|
|
||||||
return verify(obj, QMetaMethod::fromSignal(signal0));
|
|
||||||
}
|
|
||||||
public:
|
|
||||||
#endif // Q_QDOC
|
#endif // Q_QDOC
|
||||||
|
|
||||||
QSignalSpy(const QObject *obj, QMetaMethod signal)
|
QSignalSpy(const QObject *obj, QMetaMethod signal)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user