diff options
author | Vitaly Fanaskov <vitaly.fanaskov@qt.io> | 2019-08-12 14:36:06 +0200 |
---|---|---|
committer | Vitaly Fanaskov <vitaly.fanaskov@qt.io> | 2019-08-13 17:26:18 +0200 |
commit | e8c7124768b0e3e556a8ae53629478284bbdca8e (patch) | |
tree | a29ebb5ada09c6a91651c455970fb6b858232d57 /src/testlib/qsignalspy.qdoc | |
parent | c29a136804f5952c0b4c15920f3ab4032c21573c (diff) |
Introduce QSignalSpy constructor allows to spy on a meta method
This functionality is especially convenient if meta-object system is
heavily used in a test. For example, if you need to test a bunch of
signals based on their names and/or argument types.
Change-Id: I09a4ecbbd3d0859b5fd466d9dde7679804eb7614
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/testlib/qsignalspy.qdoc')
-rw-r--r-- | src/testlib/qsignalspy.qdoc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/testlib/qsignalspy.qdoc b/src/testlib/qsignalspy.qdoc index 3352307d69..5ea6bc5dc7 100644 --- a/src/testlib/qsignalspy.qdoc +++ b/src/testlib/qsignalspy.qdoc @@ -86,6 +86,28 @@ \snippet code/doc_src_qsignalspy.cpp 6 */ +/*! \fn QSignalSpy(const QObject *obj, const QMetaMethod &signal) + \since 5.14 + + Constructs a new QSignalSpy that listens for emissions of the \a signal + from the QObject \a object. If QSignalSpy is not able to listen for a + valid signal (for example, because \a object is \nullptr or \a signal does + not denote a valid signal of \a object), an explanatory warning message + will be output using qWarning() and subsequent calls to \c isValid() will + return false. + + This constructor is convenient to use when Qt's meta-object system is + heavily used in a test. + + Basic usage example: + \snippet code/doc_src_qsignalspy.cpp 7 + + Imagine we need to check whether all properties of the QWindow class + that represent minimum and maximum dimensions are properly writable. + The following example demonstrates one of the approaches: + \snippet code/doc_src_qsignalspy.cpp 8 +*/ + /*! \fn QSignalSpy::isValid() const Returns \c true if the signal spy listens to a valid signal, otherwise false. |