QMetaMethod: document that fromSignal(nullptr) is ok
... and add a test. Pick-to: 6.6 6.5 6.2 5.15 Change-Id: I907899d7c54349d2fc23ea5ab58a1e67826b622b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 78db468f4895911e50849223899abf2c5fb1c72e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
d272374203
commit
9f14d0a288
@ -2390,7 +2390,7 @@ QMetaMethod::MethodType QMetaMethod::methodType() const
|
||||
\since 5.0
|
||||
|
||||
Returns the meta-method that corresponds to the given \a signal, or an
|
||||
invalid QMetaMethod if \a signal is not a signal of the class.
|
||||
invalid QMetaMethod if \a signal is \c{nullptr} or not a signal of the class.
|
||||
|
||||
Example:
|
||||
|
||||
|
@ -22,6 +22,7 @@ private slots:
|
||||
void comparisonOperators();
|
||||
|
||||
void fromSignal();
|
||||
void fromSignalOfNullSignalIsInvalid();
|
||||
|
||||
void gadget();
|
||||
void revision();
|
||||
@ -719,6 +720,12 @@ void tst_QMetaMethod::fromSignal()
|
||||
#undef FROMSIGNAL_HELPER
|
||||
}
|
||||
|
||||
void tst_QMetaMethod::fromSignalOfNullSignalIsInvalid()
|
||||
{
|
||||
constexpr decltype(&QObject::destroyed) ptr = nullptr;
|
||||
QVERIFY(!QMetaMethod::fromSignal(ptr).isValid());
|
||||
}
|
||||
|
||||
class MyGadget {
|
||||
Q_GADGET
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user