1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qsignal.cpp:42 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QSignal Class</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QSignal Class Reference</h1>
|
---|
33 |
|
---|
34 | <p>The QSignal class can be used to send signals for classes
|
---|
35 | that don't inherit QObject.
|
---|
36 | <a href="#details">More...</a>
|
---|
37 | <p><tt>#include <<a href="qsignal-h.html">qsignal.h</a>></tt>
|
---|
38 | <p>Inherits <a href="qobject.html">QObject</a>.
|
---|
39 | <p><a href="qsignal-members.html">List of all member functions.</a>
|
---|
40 | <h2>Public Members</h2>
|
---|
41 | <ul>
|
---|
42 | <li class=fn><a href="#QSignal"><b>QSignal</b></a> ( QObject * parent = 0, const char * name = 0 )</li>
|
---|
43 | <li class=fn><a href="#~QSignal"><b>~QSignal</b></a> ()</li>
|
---|
44 | <li class=fn>bool <a href="#connect"><b>connect</b></a> ( const QObject * receiver, const char * member )</li>
|
---|
45 | <li class=fn>bool <a href="#disconnect"><b>disconnect</b></a> ( const QObject * receiver, const char * member = 0 )</li>
|
---|
46 | <li class=fn>void <a href="#activate"><b>activate</b></a> ()</li>
|
---|
47 | <li class=fn>bool isBlocked () const <em>(obsolete)</em></li>
|
---|
48 | <li class=fn>void block ( bool b ) <em>(obsolete)</em></li>
|
---|
49 | <li class=fn>void setParameter ( int value ) <em>(obsolete)</em></li>
|
---|
50 | <li class=fn>int parameter () const <em>(obsolete)</em></li>
|
---|
51 | <li class=fn>void <a href="#setValue"><b>setValue</b></a> ( const QVariant & value )</li>
|
---|
52 | <li class=fn>QVariant <a href="#value"><b>value</b></a> () const</li>
|
---|
53 | </ul>
|
---|
54 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
55 |
|
---|
56 |
|
---|
57 | The QSignal class can be used to send signals for classes
|
---|
58 | that don't inherit <a href="qobject.html">QObject</a>.
|
---|
59 | <p>
|
---|
60 |
|
---|
61 | <p> If you want to send signals from a class that does not inherit
|
---|
62 | QObject, you can create an internal QSignal object to emit the
|
---|
63 | signal. You must also provide a function that connects the signal
|
---|
64 | to an outside object slot. This is how we have implemented
|
---|
65 | signals in the <a href="qmenudata.html">QMenuData</a> class, which is not a QObject.
|
---|
66 | <p> In general, we recommend inheriting QObject instead. QObject
|
---|
67 | provides much more functionality.
|
---|
68 | <p> You can set a single <a href="qvariant.html">QVariant</a> parameter for the signal with
|
---|
69 | <a href="#setValue">setValue</a>().
|
---|
70 | <p> Note that QObject is a <em>private</em> base class of QSignal, i.e. you
|
---|
71 | cannot call any QObject member functions from a QSignal object.
|
---|
72 | <p> Example:
|
---|
73 | <pre>
|
---|
74 | #include <<a href="qsignal-h.html">qsignal.h</a>>
|
---|
75 |
|
---|
76 | class MyClass
|
---|
77 | {
|
---|
78 | public:
|
---|
79 | MyClass();
|
---|
80 | ~MyClass();
|
---|
81 |
|
---|
82 | void doSomething();
|
---|
83 |
|
---|
84 | void connect( <a href="qobject.html">QObject</a> *receiver, const char *member );
|
---|
85 |
|
---|
86 | private:
|
---|
87 | QSignal *sig;
|
---|
88 | };
|
---|
89 |
|
---|
90 | MyClass::MyClass()
|
---|
91 | {
|
---|
92 | sig = new QSignal;
|
---|
93 | }
|
---|
94 |
|
---|
95 | MyClass::~MyClass()
|
---|
96 | {
|
---|
97 | delete sig;
|
---|
98 | }
|
---|
99 |
|
---|
100 | void MyClass::doSomething()
|
---|
101 | {
|
---|
102 | // ... does something
|
---|
103 | sig-><a href="#activate">activate</a>(); // emits the signal
|
---|
104 | }
|
---|
105 |
|
---|
106 | void MyClass::connect( <a href="qobject.html">QObject</a> *receiver, const char *member )
|
---|
107 | {
|
---|
108 | sig-><a href="#connect">connect</a>( receiver, member );
|
---|
109 | }
|
---|
110 | </pre>
|
---|
111 |
|
---|
112 | <p>See also <a href="io.html">Input/Output and Networking</a> and <a href="misc.html">Miscellaneous Classes</a>.
|
---|
113 |
|
---|
114 | <hr><h2>Member Function Documentation</h2>
|
---|
115 | <h3 class=fn><a name="QSignal"></a>QSignal::QSignal ( <a href="qobject.html">QObject</a> * parent = 0, const char * name = 0 )
|
---|
116 | </h3>
|
---|
117 | Constructs a signal object called <em>name</em>, with the parent object
|
---|
118 | <em>parent</em>. These arguments are passed directly to <a href="qobject.html">QObject</a>.
|
---|
119 |
|
---|
120 | <h3 class=fn><a name="~QSignal"></a>QSignal::~QSignal ()
|
---|
121 | </h3>
|
---|
122 | Destroys the signal. All connections are removed, as is the case
|
---|
123 | with all QObjects.
|
---|
124 |
|
---|
125 | <h3 class=fn>void <a name="activate"></a>QSignal::activate ()
|
---|
126 | </h3>
|
---|
127 |
|
---|
128 | <p> Emits the signal. If the platform supports <a href="qvariant.html">QVariant</a> and a
|
---|
129 | parameter has been set with <a href="#setValue">setValue</a>(), this value is passed in
|
---|
130 | the signal.
|
---|
131 |
|
---|
132 | <h3 class=fn>void <a name="block"></a>QSignal::block ( bool b )
|
---|
133 | </h3>
|
---|
134 |
|
---|
135 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
---|
136 | <p> Blocks the signal if <em>b</em> is TRUE, or unblocks the signal if <em>b</em> is FALSE.
|
---|
137 | <p> An activated signal disappears into hyperspace if it is blocked.
|
---|
138 | <p> <p>See also <a href="#isBlocked">isBlocked</a>(), <a href="#activate">activate</a>(), and <a href="qobject.html#blockSignals">QObject::blockSignals</a>().
|
---|
139 |
|
---|
140 | <h3 class=fn>bool <a name="connect"></a>QSignal::connect ( const <a href="qobject.html">QObject</a> * receiver, const char * member )
|
---|
141 | </h3>
|
---|
142 | Connects the signal to <em>member</em> in object <em>receiver</em>.
|
---|
143 | <p> <p>See also <a href="#disconnect">disconnect</a>() and <a href="qobject.html#connect">QObject::connect</a>().
|
---|
144 |
|
---|
145 | <h3 class=fn>bool <a name="disconnect"></a>QSignal::disconnect ( const <a href="qobject.html">QObject</a> * receiver, const char * member = 0 )
|
---|
146 | </h3>
|
---|
147 | Disonnects the signal from <em>member</em> in object <em>receiver</em>.
|
---|
148 | <p> <p>See also <a href="#connect">connect</a>() and <a href="qobject.html#disconnect">QObject::disconnect</a>().
|
---|
149 |
|
---|
150 | <h3 class=fn>bool <a name="isBlocked"></a>QSignal::isBlocked () const
|
---|
151 | </h3>
|
---|
152 |
|
---|
153 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
---|
154 | <p> Returns TRUE if the signal is blocked, or FALSE if it is not blocked.
|
---|
155 | <p> The signal is not blocked by default.
|
---|
156 | <p> <p>See also <a href="#block">block</a>() and <a href="qobject.html#signalsBlocked">QObject::signalsBlocked</a>().
|
---|
157 |
|
---|
158 | <h3 class=fn>int <a name="parameter"></a>QSignal::parameter () const
|
---|
159 | </h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
---|
160 |
|
---|
161 | <h3 class=fn>void <a name="setParameter"></a>QSignal::setParameter ( int value )
|
---|
162 | </h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
---|
163 |
|
---|
164 | <h3 class=fn>void <a name="setValue"></a>QSignal::setValue ( const <a href="qvariant.html">QVariant</a> & value )
|
---|
165 | </h3>
|
---|
166 | Sets the signal's parameter to <em>value</em>
|
---|
167 |
|
---|
168 | <h3 class=fn><a href="qvariant.html">QVariant</a> <a name="value"></a>QSignal::value () const
|
---|
169 | </h3>
|
---|
170 | Returns the signal's parameter
|
---|
171 |
|
---|
172 | <!-- eof -->
|
---|
173 | <hr><p>
|
---|
174 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
175 | Copyright © 1995-2007
|
---|
176 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
177 | <table width=100% cellspacing=0 border=0><tr>
|
---|
178 | <td>Copyright © 2007
|
---|
179 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
180 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
181 | </table></div></address></body>
|
---|
182 | </html>
|
---|