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
156
157
158
159
160
161
162
163
164
165
|
'\" t
.TH TQSignal 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
TQSignal \- Can be used to send signals for classes that don't inherit TQObject
.SH SYNOPSIS
\fC#include <tqsignal.h>\fR
.PP
Inherits TQObject.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBTQSignal\fR ( TQObject * parent = 0, const char * name = 0 )"
.br
.ti -1c
.BI "\fB~TQSignal\fR ()"
.br
.ti -1c
.BI "bool \fBconnect\fR ( const TQObject * receiver, const char * member )"
.br
.ti -1c
.BI "bool \fBdisconnect\fR ( const TQObject * receiver, const char * member = 0 )"
.br
.ti -1c
.BI "void \fBactivate\fR ()"
.br
.ti -1c
.BI "void \fBsetValue\fR ( const QVariant & value )"
.br
.ti -1c
.BI "QVariant \fBvalue\fR () const"
.br
.in -1c
.SH DESCRIPTION
The TQSignal class can be used to send signals for classes that don't inherit TQObject.
.PP
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 TQMenuData class, which is not a TQObject.
.PP
In general, we recommend inheriting TQObject instead. TQObject provides much more functionality.
.PP
You can set a single QVariant parameter for the signal with setValue().
.PP
Note that TQObject is a \fIprivate\fR base class of TQSignal, i.e. you cannot call any TQObject member functions from a TQSignal object.
.PP
Example:
.PP
.nf
.br
#include <tqsignal.h>
.br
.br
class MyClass
.br
{
.br
public:
.br
MyClass();
.br
~MyClass();
.br
.br
void doSomething();
.br
.br
void connect( TQObject *receiver, const char *member );
.br
.br
private:
.br
TQSignal *sig;
.br
};
.br
.br
MyClass::MyClass()
.br
{
.br
sig = new TQSignal;
.br
}
.br
.br
MyClass::~MyClass()
.br
{
.br
delete sig;
.br
}
.br
.br
void MyClass::doSomething()
.br
{
.br
// ... does something
.br
sig->activate(); // emits the signal
.br
}
.br
.br
void MyClass::connect( TQObject *receiver, const char *member )
.br
{
.br
sig->connect( receiver, member );
.br
}
.br
.fi
.PP
See also Input/Output and Networking and Miscellaneous Classes.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "TQSignal::TQSignal ( TQObject * parent = 0, const char * name = 0 )"
Constructs a signal object called \fIname\fR, with the parent object \fIparent\fR. These arguments are passed directly to TQObject.
.SH "TQSignal::~TQSignal ()"
Destroys the signal. All connections are removed, as is the case with all TQObjects.
.SH "void TQSignal::activate ()"
Emits the signal. If the platform supports QVariant and a parameter has been set with setValue(), this value is passed in the signal.
.SH "bool TQSignal::connect ( const TQObject * receiver, const char * member )"
Connects the signal to \fImember\fR in object \fIreceiver\fR.
.PP
See also disconnect() and TQObject::connect().
.SH "bool TQSignal::disconnect ( const TQObject * receiver, const char * member = 0 )"
Disonnects the signal from \fImember\fR in object \fIreceiver\fR.
.PP
See also connect() and TQObject::disconnect().
.SH "void TQSignal::setValue ( const QVariant & value )"
Sets the signal's parameter to \fIvalue\fR
.SH "QVariant TQSignal::value () const"
Returns the signal's parameter
.SH "SEE ALSO"
.BR http://doc.trolltech.com/tqsignal.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive TQt documentation is provided in HTML format; it is
located at $TQTDIR/doc/html and can be read using TQt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR [email protected] .
Please include the name of the manual page (tqsignal.3qt) and the Qt
version (3.3.8).
|