summaryrefslogtreecommitdiffstats
path: root/doc/html/tqsignal.html
blob: 51e2a547d9d46699d69173f163170c7e0f8679cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQSignal Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQSignal Class Reference</h1>

<p>The TQSignal class can be used to send signals for classes
that don't inherit TQObject.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="tqsignal-h.html">tqsignal.h</a>&gt;</tt>
<p>Inherits <a href="tqobject.html">TQObject</a>.
<p><a href="tqsignal-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQSignal"><b>TQSignal</b></a> ( TQObject&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<li class=fn><a href="#~TQSignal"><b>~TQSignal</b></a> ()</li>
<li class=fn>bool <a href="#connect"><b>connect</b></a> ( const&nbsp;TQObject&nbsp;*&nbsp;receiver, const&nbsp;char&nbsp;*&nbsp;member )</li>
<li class=fn>bool <a href="#disconnect"><b>disconnect</b></a> ( const&nbsp;TQObject&nbsp;*&nbsp;receiver, const&nbsp;char&nbsp;*&nbsp;member = 0 )</li>
<li class=fn>void <a href="#activate"><b>activate</b></a> ()</li>
<li class=fn>void <a href="#setValue"><b>setValue</b></a> ( const&nbsp;TQVariant&nbsp;&amp;&nbsp;value )</li>
<li class=fn>TQVariant <a href="#value"><b>value</b></a> () const</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The TQSignal class can be used to send signals for classes
that don't inherit <a href="tqobject.html">TQObject</a>.
<p> 

<p> If you want to send signals from a class that does not inherit
TQObject, you can create an internal TQSignal object to emit the
signal. You must also provide a function that connects the signal
to an outside object slot.  This is how we have implemented
signals in the <a href="tqmenudata.html">TQMenuData</a> class, which is not a TQObject.
<p> In general, we recommend inheriting TQObject instead. TQObject
provides much more functionality.
<p> You can set a single <a href="tqvariant.html">TQVariant</a> parameter for the signal with
<a href="#setValue">setValue</a>().
<p> Note that TQObject is a <em>private</em> base class of TQSignal, i.e. you
cannot call any TQObject member functions from a TQSignal object.
<p> Example:
<pre>
        #include &lt;<a href="tqsignal-h.html">tqsignal.h</a>&gt;

        class MyClass
        {
        public:
            MyClass();
            ~MyClass();

            void doSomething();

            void connect( <a href="tqobject.html">TQObject</a> *receiver, const char *member );

        private:
            TQSignal *sig;
        };

        MyClass::MyClass()
        {
            sig = new TQSignal;
        }

        MyClass::~MyClass()
        {
            delete sig;
        }

        void MyClass::doSomething()
        {
            // ... does something
            sig-&gt;<a href="#activate">activate</a>(); // emits the signal
        }

        void MyClass::connect( <a href="tqobject.html">TQObject</a> *receiver, const char *member )
        {
            sig-&gt;<a href="#connect">connect</a>( receiver, member );
        }
    </pre>
 
<p>See also <a href="io.html">Input/Output and Networking</a> and <a href="misc.html">Miscellaneous Classes</a>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQSignal"></a>TQSignal::TQSignal ( <a href="tqobject.html">TQObject</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>
Constructs a signal object called <em>name</em>, with the parent object
<em>parent</em>. These arguments are passed directly to <a href="tqobject.html">TQObject</a>.

<h3 class=fn><a name="~TQSignal"></a>TQSignal::~TQSignal ()
</h3>
Destroys the signal. All connections are removed, as is the case
with all TQObjects.

<h3 class=fn>void <a name="activate"></a>TQSignal::activate ()
</h3>

<p> Emits the signal. If the platform supports <a href="tqvariant.html">TQVariant</a> and a
parameter has been set with <a href="#setValue">setValue</a>(), this value is passed in
the signal.

<h3 class=fn>bool <a name="connect"></a>TQSignal::connect ( const&nbsp;<a href="tqobject.html">TQObject</a>&nbsp;*&nbsp;receiver, const&nbsp;char&nbsp;*&nbsp;member )
</h3>
Connects the signal to <em>member</em> in object <em>receiver</em>.
<p> <p>See also <a href="#disconnect">disconnect</a>() and <a href="tqobject.html#connect">TQObject::connect</a>().

<h3 class=fn>bool <a name="disconnect"></a>TQSignal::disconnect ( const&nbsp;<a href="tqobject.html">TQObject</a>&nbsp;*&nbsp;receiver, const&nbsp;char&nbsp;*&nbsp;member = 0 )
</h3>
Disonnects the signal from <em>member</em> in object <em>receiver</em>.
<p> <p>See also <a href="#connect">connect</a>() and <a href="tqobject.html#disconnect">TQObject::disconnect</a>().

<h3 class=fn>void <a name="setValue"></a>TQSignal::setValue ( const&nbsp;<a href="tqvariant.html">TQVariant</a>&nbsp;&amp;&nbsp;value )
</h3>
Sets the signal's parameter to <em>value</em>

<h3 class=fn><a href="tqvariant.html">TQVariant</a> <a name="value"></a>TQSignal::value () const
</h3>
Returns the signal's parameter

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>