author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 04 Oct 2010 01:19:32 +0300 | |
changeset 37 | 758a864f9613 |
parent 33 | 3e2da88830cd |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the documentation of the Qt Toolkit. |
|
8 |
** |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
9 |
** $QT_BEGIN_LICENSE:FDL$ |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
10 |
** Commercial Usage |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
11 |
** Licensees holding valid Qt Commercial licenses may use this file in |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
12 |
** accordance with the Qt Commercial License Agreement provided with the |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
13 |
** Software or, alternatively, in accordance with the terms contained in a |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
14 |
** written agreement between you and Nokia. |
0 | 15 |
** |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
16 |
** GNU Free Documentation License |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
17 |
** Alternatively, this file may be used under the terms of the GNU Free |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
18 |
** Documentation License version 1.3 as published by the Free Software |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
19 |
** Foundation and appearing in the file included in the packaging of this |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
20 |
** file. |
0 | 21 |
** |
22 |
** If you have questions regarding the use of this file, please contact |
|
23 |
** Nokia at qt-info@nokia.com. |
|
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 doc/src/snippets/code/doc_src_qsignalspy.qdoc 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 doc/src/snippets/code/doc_src_qsignalspy.qdoc 1 |
|
50 |
||
51 |
\bold {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 doc/src/snippets/code/doc_src_qsignalspy.qdoc 2 |
|
56 |
||
57 |
To retrieve the \c QModelIndex, you can use qvariant_cast: |
|
58 |
||
59 |
\snippet doc/src/snippets/code/doc_src_qsignalspy.qdoc 3 |
|
60 |
*/ |
|
61 |
||
62 |
/*! \fn QSignalSpy::QSignalSpy(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. Neither \a signal nor \a object can be null. |
|
66 |
||
67 |
Example: |
|
68 |
\snippet doc/src/snippets/code/doc_src_qsignalspy.qdoc 4 |
|
69 |
*/ |
|
70 |
||
71 |
/*! \fn QSignalSpy::isValid() const |
|
72 |
||
73 |
Returns true if the signal spy listens to a valid signal, otherwise false. |
|
74 |
*/ |
|
75 |
||
76 |
/*! \fn QSignalSpy::signal() const |
|
77 |
||
78 |
Returns the normalized signal the spy is currently listening to. |
|
79 |
*/ |
|
80 |
||
81 |
/*! \fn int QSignalSpy::qt_metacall(QMetaObject::Call call, int id, void **a) |
|
82 |
\internal |
|
83 |
*/ |
|
84 |