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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
'\" t
.TH QEventLoop 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
QEventLoop \- Manages the event queue
.SH SYNOPSIS
\fC#include <ntqeventloop.h>\fR
.PP
Inherits QObject.
.PP
Inherited by QMotif.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQEventLoop\fR ( QObject * parent = 0, const char * name = 0 )"
.br
.ti -1c
.BI "\fB~QEventLoop\fR ()"
.br
.ti -1c
.BI "enum \fBProcessEvents\fR { AllEvents = 0x00, ExcludeUserInput = 0x01, ExcludeSocketNotifiers = 0x02, WaitForMore = 0x04 }"
.br
.ti -1c
.BI "typedef uint \fBProcessEventsFlags\fR"
.br
.ti -1c
.BI "void \fBprocessEvents\fR ( ProcessEventsFlags flags, int maxTime )"
.br
.ti -1c
.BI "virtual bool \fBprocessEvents\fR ( ProcessEventsFlags flags )"
.br
.ti -1c
.BI "virtual bool \fBhasPendingEvents\fR () const"
.br
.ti -1c
.BI "virtual void \fBregisterSocketNotifier\fR ( QSocketNotifier * notifier )"
.br
.ti -1c
.BI "virtual void \fBunregisterSocketNotifier\fR ( QSocketNotifier * notifier )"
.br
.ti -1c
.BI "void \fBsetSocketNotifierPending\fR ( QSocketNotifier * notifier )"
.br
.ti -1c
.BI "int \fBactivateSocketNotifiers\fR ()"
.br
.ti -1c
.BI "int \fBactivateTimers\fR ()"
.br
.ti -1c
.BI "int \fBtimeToWait\fR () const"
.br
.ti -1c
.BI "virtual int \fBexec\fR ()"
.br
.ti -1c
.BI "virtual void \fBexit\fR ( int retcode = 0 )"
.br
.ti -1c
.BI "virtual int \fBenterLoop\fR ()"
.br
.ti -1c
.BI "virtual void \fBexitLoop\fR ()"
.br
.ti -1c
.BI "virtual int \fBloopLevel\fR () const"
.br
.ti -1c
.BI "virtual void \fBwakeUp\fR ()"
.br
.in -1c
.SS "Signals"
.in +1c
.ti -1c
.BI "void \fBawake\fR ()"
.br
.ti -1c
.BI "void \fBaboutToBlock\fR ()"
.br
.in -1c
.SH DESCRIPTION
The QEventLoop class manages the event queue.
.PP
It receives events from the window system and other sources. It then sends them to QApplication for processing and delivery.
.PP
QEventLoop allows the application programmer to have more control over event delivery. Programs that perform long operations can call either processOneEvent() or processEvents() with various ProcessEvent values OR'ed together to control which events should be delivered.
.PP
QEventLoop also allows the integration of an external event loop with the Qt event loop. The Motif Extension included with Qt includes a reimplementation of QEventLoop for merging Qt and Motif events together.
.PP
To use your own instance of QEventLoop or QEventLoop subclass create it before you create the QApplication object.
.PP
See also Main Window and Related Classes and Event Classes.
.SS "Member Type Documentation"
.SH "QEventLoop::ProcessEvents"
This enum controls the types of events processed by the processEvents() functions.
.TP
\fCQEventLoop::AllEvents\fR - All events are processed
.TP
\fCQEventLoop::ExcludeUserInput\fR - Do not process user input events. ( ButtonPress, KeyPress, etc. )
.TP
\fCQEventLoop::ExcludeSocketNotifiers\fR - Do not process socket notifier events.
.TP
\fCQEventLoop::WaitForMore\fR - Wait for events if no pending events are available.
.PP
See also processEvents().
.SH "QEventLoop::ProcessEventsFlags"
A \fCtypedef\fR to allow various ProcessEvents values to be OR'ed together.
.PP
See also ProcessEvents.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QEventLoop::QEventLoop ( QObject * parent = 0, const char * name = 0 )"
Creates a QEventLoop object, this object becomes the global event loop object. There can only be one event loop object. The QEventLoop is usually constructed by calling QApplication::eventLoop(). To create your own event loop object create it before you instantiate the QApplication object.
.PP
The \fIparent\fR and \fIname\fR arguments are passed on to the QObject constructor.
.SH "QEventLoop::~QEventLoop ()"
Destructs the QEventLoop object.
.SH "void QEventLoop::aboutToBlock ()\fC [signal]\fR"
This signal is emitted before the event loop calls a function that could block.
.PP
See also awake().
.SH "int QEventLoop::activateSocketNotifiers ()"
Activates all pending socket notifiers and returns the number of socket notifiers that were activated.
.SH "int QEventLoop::activateTimers ()"
Activates all Qt timers and returns the number of timers that were activated.
.PP
QEventLoop subclasses that do their own timer handling need to call this after the time returned by timeToWait() has elapsed.
.PP
Note: This function is only useful on systems where \fCselect()\fR is used to block the eventloop. On Windows, this function always returns 0. On MacOS X, this function always returns 0 when the GUI is enabled. On MacOS X, this function returns the documented value when the GUI is disabled.
.SH "void QEventLoop::awake ()\fC [signal]\fR"
This signal is emitted after the event loop returns from a function that could block.
.PP
See also wakeUp() and aboutToBlock().
.SH "int QEventLoop::enterLoop ()\fC [virtual]\fR"
This function enters the main event loop (recursively). Do not call it unless you really know what you are doing.
.SH "int QEventLoop::exec ()\fC [virtual]\fR"
Enters the main event loop and waits until exit() is called, and returns the value that was set to exit().
.PP
It is necessary to call this function to start event handling. The main event loop receives events from the window system and dispatches these to the application widgets.
.PP
Generally speaking, no user interaction can take place before calling exec(). As a special case, modal widgets like QMessageBox can be used before calling exec(), because modal widgets call exec() to start a local event loop.
.PP
To make your application perform idle processing, i.e. executing a special function whenever there are no pending events, use a QTimer with 0 timeout. More advanced idle processing schemes can be achieved using processEvents().
.PP
See also QApplication::quit(), exit(), and processEvents().
.SH "void QEventLoop::exit ( int retcode = 0 )\fC [virtual]\fR"
Tells the event loop to exit with a return code.
.PP
After this function has been called, the event loop returns from the call to exec(). The exec() function returns \fIretcode\fR.
.PP
By convention, a \fIretcode\fR of 0 means success, and any non-zero value indicates an error.
.PP
Note that unlike the C library function of the same name, this function \fIdoes\fR return to the caller -- it is event processing that stops.
.PP
See also QApplication::quit() and exec().
.SH "void QEventLoop::exitLoop ()\fC [virtual]\fR"
This function exits from a recursive call to the main event loop. Do not call it unless you really know what you are doing.
.SH "bool QEventLoop::hasPendingEvents () const\fC [virtual]\fR"
Returns TRUE if there is an event waiting, otherwise it returns FALSE.
.SH "int QEventLoop::loopLevel () const\fC [virtual]\fR"
Returns the current loop level.
.SH "void QEventLoop::processEvents ( ProcessEventsFlags flags, int maxTime )"
Process pending events that match \fIflags\fR for a maximum of \fImaxTime\fR milliseconds, or until there are no more events to process, which ever is shorter.
.PP
This function is especially useful if you have a long running operation and want to show its progress without allowing user input, i.e. by using the ExcludeUserInput flag.
.PP
NOTE: This function will not process events continuously; it returns after all available events are processed.
.PP
NOTE: Specifying the WaitForMore flag makes no sense and will be ignored.
.SH "bool QEventLoop::processEvents ( ProcessEventsFlags flags )\fC [virtual]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Processes pending events that match \fIflags\fR until there are no more events to process.
.PP
This function is especially useful if you have a long running operation and want to show its progress without allowing user input, i.e. by using the ExcludeUserInput flag.
.PP
If the WaitForMore flag is set in \fIflags\fR, the behavior of this function is as follows:
.IP
.TP
If events are available, this function returns after processing them.
.IP
.TP
If no events are available, this function will wait until more are available and return after processing newly available events.
.IP
.PP
If the WaitForMore flag is \fInot\fR set in \fIflags\fR, and no events are available, this function will return immediately.
.PP
NOTE: This function will not process events continuously; it returns after all available events are processed.
.PP
This function returns TRUE if an event was processed; otherwise it returns FALSE.
.PP
See also ProcessEvents and hasPendingEvents().
.SH "void QEventLoop::registerSocketNotifier ( QSocketNotifier * notifier )\fC [virtual]\fR"
Registers \fInotifier\fR with the event loop. Subclasses need to reimplement this method to tie a socket notifier into another event loop. Reimplementations \fIMUST\fR call the base implementation.
.SH "void QEventLoop::setSocketNotifierPending ( QSocketNotifier * notifier )"
Marks \fInotifier\fR as pending. The socket notifier will be activated the next time activateSocketNotifiers() is called.
.SH "int QEventLoop::timeToWait () const"
Returns the number of milliseconds that Qt needs to handle its timers or -1 if there are no timers running.
.PP
QEventLoop subclasses that do their own timer handling need to use this to make sure that Qt's timers continue to work.
.PP
Note: This function is only useful on systems where \fCselect()\fR is used to block the eventloop. On Windows, this function always returns -1. On MacOS X, this function always returns -1 when the GUI is enabled. On MacOS X, this function returns the documented value when the GUI is disabled.
.SH "void QEventLoop::unregisterSocketNotifier ( QSocketNotifier * notifier )\fC [virtual]\fR"
Unregisters \fInotifier\fR from the event loop. Subclasses need to reimplement this method to tie a socket notifier into another event loop. Reimplementations \fIMUST\fR call the base implementation.
.SH "void QEventLoop::wakeUp ()\fC [virtual]\fR"
\fBNote:\fR This function is thread-safe when Qt is built withthread support.</p>
.PP
Wakes up the event loop.
.PP
See also awake().
.SH "SEE ALSO"
.BR http://doc.trolltech.com/ntqeventloop.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 (qeventloop.3qt) and the Qt
version (3.3.8).
|