summaryrefslogtreecommitdiffstats
path: root/doc/man/man3/qsignal.3qt
blob: be2f63d982d5cc33a2822a569b63550e003cd2fb (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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
'\" t
.TH QSignal 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
QSignal \- Can be used to send signals for classes that don't inherit QObject
.SH SYNOPSIS
\fC#include <ntqsignal.h>\fR
.PP
Inherits QObject.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQSignal\fR ( QObject * parent = 0, const char * name = 0 )"
.br
.ti -1c
.BI "\fB~QSignal\fR ()"
.br
.ti -1c
.BI "bool \fBconnect\fR ( const QObject * receiver, const char * member )"
.br
.ti -1c
.BI "bool \fBdisconnect\fR ( const QObject * receiver, const char * member = 0 )"
.br
.ti -1c
.BI "void \fBactivate\fR ()"
.br
.ti -1c
.BI "bool isBlocked () const  \fI(obsolete)\fR"
.br
.ti -1c
.BI "void block ( bool b )  \fI(obsolete)\fR"
.br
.ti -1c
.BI "void setParameter ( int value )  \fI(obsolete)\fR"
.br
.ti -1c
.BI "int parameter () const  \fI(obsolete)\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 QSignal class can be used to send signals for classes that don't inherit QObject.
.PP
If you want to send signals from a class that does not inherit QObject, you can create an internal QSignal 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 QMenuData class, which is not a QObject.
.PP
In general, we recommend inheriting QObject instead. QObject provides much more functionality.
.PP
You can set a single QVariant parameter for the signal with setValue().
.PP
Note that QObject is a \fIprivate\fR base class of QSignal, i.e. you cannot call any QObject member functions from a QSignal object.
.PP
Example:
.PP
.nf
.br
        #include <ntqsignal.h>
.br
.br
        class MyClass
.br
        {
.br
        public:
.br
            MyClass();
.br
            ~MyClass();
.br
.br
            void doSomething();
.br
.br
            void connect( QObject *receiver, const char *member );
.br
.br
        private:
.br
            QSignal *sig;
.br
        };
.br
.br
        MyClass::MyClass()
.br
        {
.br
            sig = new QSignal;
.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( QObject *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 "QSignal::QSignal ( QObject * 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 QObject.
.SH "QSignal::~QSignal ()"
Destroys the signal. All connections are removed, as is the case with all QObjects.
.SH "void QSignal::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 "void QSignal::block ( bool b )"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Blocks the signal if \fIb\fR is TRUE, or unblocks the signal if \fIb\fR is FALSE.
.PP
An activated signal disappears into hyperspace if it is blocked.
.PP
See also isBlocked(), activate(), and QObject::blockSignals().
.SH "bool QSignal::connect ( const QObject * receiver, const char * member )"
Connects the signal to \fImember\fR in object \fIreceiver\fR.
.PP
See also disconnect() and QObject::connect().
.SH "bool QSignal::disconnect ( const QObject * receiver, const char * member = 0 )"
Disonnects the signal from \fImember\fR in object \fIreceiver\fR.
.PP
See also connect() and QObject::disconnect().
.SH "bool QSignal::isBlocked () const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Returns TRUE if the signal is blocked, or FALSE if it is not blocked.
.PP
The signal is not blocked by default.
.PP
See also block() and QObject::signalsBlocked().
.SH "int QSignal::parameter () const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.SH "void QSignal::setParameter ( int value )"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.SH "void QSignal::setValue ( const QVariant & value )"
Sets the signal's parameter to \fIvalue\fR
.SH "QVariant QSignal::value () const"
Returns the signal's parameter

.SH "SEE ALSO"
.BR http://doc.trolltech.com/ntqsignal.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 Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt 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 qt-bugs@trolltech.com .
Please include the name of the manual page (qsignal.3qt) and the Qt
version (3.3.8).