1QEventLoop(3qt)                                                QEventLoop(3qt)
2
3
4

NAME

6       QEventLoop - Manages the event queue
7

SYNOPSIS

9       #include <qeventloop.h>
10
11       Inherits QObject.
12
13       Inherited by QMotif.
14
15   Public Members
16       QEventLoop ( QObject * parent = 0, const char * name = 0 )
17       ~QEventLoop ()
18       enum ProcessEvents { AllEvents = 0x00, ExcludeUserInput = 0x01,
19           ExcludeSocketNotifiers = 0x02, WaitForMore = 0x04 }
20       typedef uint ProcessEventsFlags
21       void processEvents ( ProcessEventsFlags flags, int maxTime )
22       virtual bool processEvents ( ProcessEventsFlags flags )
23       virtual bool hasPendingEvents () const
24       virtual void registerSocketNotifier ( QSocketNotifier * notifier )
25       virtual void unregisterSocketNotifier ( QSocketNotifier * notifier )
26       void setSocketNotifierPending ( QSocketNotifier * notifier )
27       int activateSocketNotifiers ()
28       int activateTimers ()
29       int timeToWait () const
30       virtual int exec ()
31       virtual void exit ( int retcode = 0 )
32       virtual int enterLoop ()
33       virtual void exitLoop ()
34       virtual int loopLevel () const
35       virtual void wakeUp ()
36
37   Signals
38       void awake ()
39       void aboutToBlock ()
40

DESCRIPTION

42       The QEventLoop class manages the event queue.
43
44       It receives events from the window system and other sources. It then
45       sends them to QApplication for processing and delivery.
46
47       QEventLoop allows the application programmer to have more control over
48       event delivery. Programs that perform long operations can call either
49       processOneEvent() or processEvents() with various ProcessEvent values
50       OR'ed together to control which events should be delivered.
51
52       QEventLoop also allows the integration of an external event loop with
53       the Qt event loop. The Motif Extension included with Qt includes a
54       reimplementation of QEventLoop for merging Qt and Motif events
55       together.
56
57       To use your own instance of QEventLoop or QEventLoop subclass create it
58       before you create the QApplication object.
59
60       See also Main Window and Related Classes and Event Classes.
61
62   Member Type Documentation

QEventLoop::ProcessEvents

64       This enum controls the types of events processed by the processEvents()
65       functions.
66
67       QEventLoop::AllEvents - All events are processed
68
69       QEventLoop::ExcludeUserInput - Do not process user input events. (
70       ButtonPress, KeyPress, etc. )
71
72       QEventLoop::ExcludeSocketNotifiers - Do not process socket notifier
73       events.
74
75       QEventLoop::WaitForMore - Wait for events if no pending events are
76       available.
77
78       See also processEvents().
79

QEventLoop::ProcessEventsFlags

81       A typedef to allow various ProcessEvents values to be OR'ed together.
82
83       See also ProcessEvents.
84

MEMBER FUNCTION DOCUMENTATION

QEventLoop::QEventLoop ( QObject * parent = 0, const char * name = 0 )

87       Creates a QEventLoop object, this object becomes the global event loop
88       object. There can only be one event loop object. The QEventLoop is
89       usually constructed by calling QApplication::eventLoop(). To create
90       your own event loop object create it before you instantiate the
91       QApplication object.
92
93       The parent and name arguments are passed on to the QObject constructor.
94

QEventLoop::~QEventLoop ()

96       Destructs the QEventLoop object.
97

void QEventLoop::aboutToBlock () [signal]

99       This signal is emitted before the event loop calls a function that
100       could block.
101
102       See also awake().
103

int QEventLoop::activateSocketNotifiers ()

105       Activates all pending socket notifiers and returns the number of socket
106       notifiers that were activated.
107

int QEventLoop::activateTimers ()

109       Activates all Qt timers and returns the number of timers that were
110       activated.
111
112       QEventLoop subclasses that do their own timer handling need to call
113       this after the time returned by timeToWait() has elapsed.
114
115       Note: This function is only useful on systems where select() is used to
116       block the eventloop. On Windows, this function always returns 0. On
117       MacOS X, this function always returns 0 when the GUI is enabled. On
118       MacOS X, this function returns the documented value when the GUI is
119       disabled.
120

void QEventLoop::awake () [signal]

122       This signal is emitted after the event loop returns from a function
123       that could block.
124
125       See also wakeUp() and aboutToBlock().
126

int QEventLoop::enterLoop () [virtual]

128       This function enters the main event loop (recursively). Do not call it
129       unless you really know what you are doing.
130

int QEventLoop::exec () [virtual]

132       Enters the main event loop and waits until exit() is called, and
133       returns the value that was set to exit().
134
135       It is necessary to call this function to start event handling. The main
136       event loop receives events from the window system and dispatches these
137       to the application widgets.
138
139       Generally speaking, no user interaction can take place before calling
140       exec(). As a special case, modal widgets like QMessageBox can be used
141       before calling exec(), because modal widgets call exec() to start a
142       local event loop.
143
144       To make your application perform idle processing, i.e. executing a
145       special function whenever there are no pending events, use a QTimer
146       with 0 timeout. More advanced idle processing schemes can be achieved
147       using processEvents().
148
149       See also QApplication::quit(), exit(), and processEvents().
150

void QEventLoop::exit ( int retcode = 0 ) [virtual]

152       Tells the event loop to exit with a return code.
153
154       After this function has been called, the event loop returns from the
155       call to exec(). The exec() function returns retcode.
156
157       By convention, a retcode of 0 means success, and any non-zero value
158       indicates an error.
159
160       Note that unlike the C library function of the same name, this function
161       does return to the caller -- it is event processing that stops.
162
163       See also QApplication::quit() and exec().
164

void QEventLoop::exitLoop () [virtual]

166       This function exits from a recursive call to the main event loop. Do
167       not call it unless you really know what you are doing.
168

bool QEventLoop::hasPendingEvents () const [virtual]

170       Returns TRUE if there is an event waiting, otherwise it returns FALSE.
171

int QEventLoop::loopLevel () const [virtual]

173       Returns the current loop level.
174

void QEventLoop::processEvents ( ProcessEventsFlags flags, int maxTime )

176       Process pending events that match flags for a maximum of maxTime
177       milliseconds, or until there are no more events to process, which ever
178       is shorter.
179
180       This function is especially useful if you have a long running operation
181       and want to show its progress without allowing user input, i.e. by
182       using the ExcludeUserInput flag.
183
184       NOTE: This function will not process events continuously; it returns
185       after all available events are processed.
186
187       NOTE: Specifying the WaitForMore flag makes no sense and will be
188       ignored.
189

bool QEventLoop::processEvents ( ProcessEventsFlags flags ) [virtual]

191       This is an overloaded member function, provided for convenience. It
192       behaves essentially like the above function.
193
194       Processes pending events that match flags until there are no more
195       events to process.
196
197       This function is especially useful if you have a long running operation
198       and want to show its progress without allowing user input, i.e. by
199       using the ExcludeUserInput flag.
200
201       If the WaitForMore flag is set in flags, the behavior of this function
202       is as follows:
203
204       If events are available, this function returns after processing them.
205
206       If no events are available, this function will wait until more are
207       available and return after processing newly available events.
208
209       If the WaitForMore flag is not set in flags, and no events are
210       available, this function will return immediately.
211
212       NOTE: This function will not process events continuously; it returns
213       after all available events are processed.
214
215       This function returns TRUE if an event was processed; otherwise it
216       returns FALSE.
217
218       See also ProcessEvents and hasPendingEvents().
219

void QEventLoop::registerSocketNotifier ( QSocketNotifier * notifier )

221       [virtual]
222       Registers notifier with the event loop. Subclasses need to reimplement
223       this method to tie a socket notifier into another event loop.
224       Reimplementations MUST call the base implementation.
225

void QEventLoop::setSocketNotifierPending ( QSocketNotifier * notifier )

227       Marks notifier as pending. The socket notifier will be activated the
228       next time activateSocketNotifiers() is called.
229

int QEventLoop::timeToWait () const

231       Returns the number of milliseconds that Qt needs to handle its timers
232       or -1 if there are no timers running.
233
234       QEventLoop subclasses that do their own timer handling need to use this
235       to make sure that Qt's timers continue to work.
236
237       Note: This function is only useful on systems where select() is used to
238       block the eventloop. On Windows, this function always returns -1. On
239       MacOS X, this function always returns -1 when the GUI is enabled. On
240       MacOS X, this function returns the documented value when the GUI is
241       disabled.
242

void QEventLoop::unregisterSocketNotifier ( QSocketNotifier * notifier )

244       [virtual]
245       Unregisters notifier from the event loop. Subclasses need to
246       reimplement this method to tie a socket notifier into another event
247       loop. Reimplementations MUST call the base implementation.
248

void QEventLoop::wakeUp () [virtual]

250       Note: This function is thread-safe when Qt is built withthread
251       support.</p>
252
253       Wakes up the event loop.
254
255       See also awake().
256
257

SEE ALSO

259       http://doc.trolltech.com/qeventloop.html
260       http://www.trolltech.com/faq/tech.html
261
263       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
264       license file included in the distribution for a complete license
265       statement.
266

AUTHOR

268       Generated automatically from the source code.
269

BUGS

271       If you find a bug in Qt, please report it as described in
272       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
273       help you. Thank you.
274
275       The definitive Qt documentation is provided in HTML format; it is
276       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
277       web browser. This man page is provided as a convenience for those users
278       who prefer man pages, although this format is not officially supported
279       by Trolltech.
280
281       If you find errors in this manual page, please report them to qt-
282       bugs@trolltech.com.  Please include the name of the manual page
283       (qeventloop.3qt) and the Qt version (3.3.8).
284
285
286
287Trolltech AS                    2 February 2007                QEventLoop(3qt)
Impressum