source: trunk/doc/html/qsignal.html

Last change on this file was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 8.1 KB
Line 
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"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { 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&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;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&nbsp;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
35that don't inherit QObject.
36<a href="#details">More...</a>
37<p><tt>#include &lt;<a href="qsignal-h.html">qsignal.h</a>&gt;</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&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;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&nbsp;QObject&nbsp;*&nbsp;receiver, const&nbsp;char&nbsp;*&nbsp;member )</li>
45<li class=fn>bool <a href="#disconnect"><b>disconnect</b></a> ( const&nbsp;QObject&nbsp;*&nbsp;receiver, const&nbsp;char&nbsp;*&nbsp;member = 0 )</li>
46<li class=fn>void <a href="#activate"><b>activate</b></a> ()</li>
47<li class=fn>bool isBlocked () const &nbsp;<em>(obsolete)</em></li>
48<li class=fn>void block ( bool&nbsp;b ) &nbsp;<em>(obsolete)</em></li>
49<li class=fn>void setParameter ( int&nbsp;value ) &nbsp;<em>(obsolete)</em></li>
50<li class=fn>int parameter () const &nbsp;<em>(obsolete)</em></li>
51<li class=fn>void <a href="#setValue"><b>setValue</b></a> ( const&nbsp;QVariant&nbsp;&amp;&nbsp;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
57The QSignal class can be used to send signals for classes
58that 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
62QObject, you can create an internal QSignal object to emit the
63signal. You must also provide a function that connects the signal
64to an outside object slot. This is how we have implemented
65signals in the <a href="qmenudata.html">QMenuData</a> class, which is not a QObject.
66<p> In general, we recommend inheriting QObject instead. QObject
67provides 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
71cannot call any QObject member functions from a QSignal object.
72<p> Example:
73<pre>
74 #include &lt;<a href="qsignal-h.html">qsignal.h</a>&gt;
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-&gt;<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-&gt;<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>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
116</h3>
117Constructs 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>
122Destroys the signal. All connections are removed, as is the case
123with 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
129parameter has been set with <a href="#setValue">setValue</a>(), this value is passed in
130the signal.
131
132<h3 class=fn>void <a name="block"></a>QSignal::block ( bool&nbsp;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&nbsp;<a href="qobject.html">QObject</a>&nbsp;*&nbsp;receiver, const&nbsp;char&nbsp;*&nbsp;member )
141</h3>
142Connects 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&nbsp;<a href="qobject.html">QObject</a>&nbsp;*&nbsp;receiver, const&nbsp;char&nbsp;*&nbsp;member = 0 )
146</h3>
147Disonnects 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&nbsp;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&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;value )
165</h3>
166Sets 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>
170Returns the signal's parameter
171
172<!-- eof -->
173<hr><p>
174This file is part of the <a href="index.html">Qt toolkit</a>.
175Copyright &copy; 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 &copy; 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>
Note: See TracBrowser for help on using the repository browser.