Warning: That file was not part of the compilation database. It may have many parsing errors.

1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the documentation of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:FDL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Free Documentation License Usage
18** Alternatively, this file may be used under the terms of the GNU Free
19** Documentation License version 1.3 as published by the Free Software
20** Foundation and appearing in the file included in the packaging of
21** this file. Please review the following information to ensure
22** the GNU Free Documentation License version 1.3 requirements
23** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
24** $QT_END_LICENSE$
25**
26****************************************************************************/
27
28/*!
29 \class QSignalSpy
30 \inmodule QtTest
31
32 \brief The QSignalSpy class enables introspection of signal emission.
33
34 QSignalSpy can connect to any signal of any object and records its emission.
35 QSignalSpy itself is a list of QVariant lists. Each emission of the signal
36 will append one item to the list, containing the arguments of the signal.
37
38 The following example records all signal emissions for the \c clicked() signal
39 of a QCheckBox:
40
41 \snippet code/doc_src_qsignalspy.cpp 0
42
43 \c{spy.takeFirst()} returns the arguments for the first emitted signal, as a
44 list of QVariant objects. The \c clicked() signal has a single bool argument,
45 which is stored as the first entry in the list of arguments.
46
47 The example below catches a signal from a custom object:
48
49 \snippet code/doc_src_qsignalspy.cpp 1
50
51 \b {Note:} Non-standard data types need to be registered, using
52 the qRegisterMetaType() function, before you can create a
53 QSignalSpy. For example:
54
55 \snippet code/doc_src_qsignalspy.cpp 2
56
57 To retrieve the instance, you can use qvariant_cast:
58
59 \snippet code/doc_src_qsignalspy.cpp 3
60 */
61
62/*! \fn QSignalSpy::QSignalSpy(const QObject *object, const char *signal)
63
64 Constructs a new QSignalSpy that listens for emissions of the \a signal
65 from the QObject \a object. If QSignalSpy is not able to listen for a
66 valid signal (for example, because \a object is \nullptr or \a signal does
67 not denote a valid signal of \a object), an explanatory warning message
68 will be output using qWarning() and subsequent calls to \c isValid() will
69 return false.
70
71 Example:
72 \snippet code/doc_src_qsignalspy.cpp 4
73*/
74
75/*! \fn template <typename PointerToMemberFunction> QSignalSpy::QSignalSpy(const QObject *object, PointerToMemberFunction signal)
76 \since 5.4
77
78 Constructs a new QSignalSpy that listens for emissions of the \a signal
79 from the QObject \a object. If QSignalSpy is not able to listen for a
80 valid signal (for example, because \a object is \nullptr or \a signal does
81 not denote a valid signal of \a object), an explanatory warning message
82 will be output using qWarning() and subsequent calls to \c isValid() will
83 return false.
84
85 Example:
86 \snippet code/doc_src_qsignalspy.cpp 6
87*/
88
89/*! \fn QSignalSpy::isValid() const
90
91 Returns \c true if the signal spy listens to a valid signal, otherwise false.
92*/
93
94/*! \fn QSignalSpy::signal() const
95
96 Returns the normalized signal the spy is currently listening to.
97*/
98
99/*! \fn int QSignalSpy::qt_metacall(QMetaObject::Call call, int id, void **a)
100 \internal
101*/
102
103/*! \fn QSignalSpy::wait(int timeout)
104
105 \since 5.0
106
107 Starts an event loop that runs until the given signal is received.
108 Optionally the event loop can return earlier on a \a timeout (in milliseconds).
109
110 Returns \c true if the signal was emitted at least once in \a timeout milliseconds, otherwise returns \c false.
111
112 Example:
113 \snippet code/doc_src_qsignalspy.cpp 5
114*/
115

Warning: That file was not part of the compilation database. It may have many parsing errors.