~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/qabstracteventdispatcher.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/corelib/kernel/qabstracteventdispatcher.cpp -->
 
6
<head>
 
7
    <title>Qt 4.0: QAbstractEventDispatcher Class Reference</title>
 
8
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
 
9
a:link { color: #004faf; text-decoration: none }
 
10
a:visited { color: #672967; text-decoration: none }
 
11
td.postheader { font-family: sans-serif }
 
12
tr.address { font-family: sans-serif }
 
13
body { background: #ffffff; color: black; }</style>
 
14
</head>
 
15
<body>
 
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
17
<tr>
 
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
19
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
 
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QAbstractEventDispatcher Class Reference</h1>
 
21
<p>The QAbstractEventDispatcher class manages Qt's event queue, excluding GUI-related events. <a href="#details">More...</a></p>
 
22
<pre>#include &lt;QAbstractEventDispatcher&gt;</pre><p>Part of the <a href="qtcore.html">QtCore</a> module.</p>
 
23
<p>Inherits <a href="qobject.html">QObject</a>.</p>
 
24
<ul>
 
25
<li><a href="qabstracteventdispatcher-members.html">List of all members, including inherited members</a></li>
 
26
</ul>
 
27
<a name="public-types"></a>
 
28
<h3>Public Types</h3>
 
29
<ul>
 
30
<li><div class="fn"/>typedef <b><a href="qabstracteventdispatcher.html#EventFilter-typedef">EventFilter</a></b></li>
 
31
<li><div class="fn"/>typedef <b><a href="qabstracteventdispatcher.html#TimerInfo-typedef">TimerInfo</a></b></li>
 
32
</ul>
 
33
<a name="public-functions"></a>
 
34
<h3>Public Functions</h3>
 
35
<ul>
 
36
<li><div class="fn"/><b><a href="qabstracteventdispatcher.html#QAbstractEventDispatcher">QAbstractEventDispatcher</a></b> ( QObject * <i>parent</i> = 0 )</li>
 
37
<li><div class="fn"/><b><a href="qabstracteventdispatcher.html#dtor.QAbstractEventDispatcher">~QAbstractEventDispatcher</a></b> ()</li>
 
38
<li><div class="fn"/>bool <b><a href="qabstracteventdispatcher.html#filterEvent">filterEvent</a></b> ( void * <i>message</i> )</li>
 
39
<li><div class="fn"/>virtual void <b><a href="qabstracteventdispatcher.html#flush">flush</a></b> () = 0</li>
 
40
<li><div class="fn"/>virtual bool <b><a href="qabstracteventdispatcher.html#hasPendingEvents">hasPendingEvents</a></b> () = 0</li>
 
41
<li><div class="fn"/>virtual void <b><a href="qabstracteventdispatcher.html#interrupt">interrupt</a></b> () = 0</li>
 
42
<li><div class="fn"/>virtual bool <b><a href="qabstracteventdispatcher.html#processEvents">processEvents</a></b> ( QEventLoop::ProcessEventsFlags <i>flags</i> ) = 0</li>
 
43
<li><div class="fn"/>virtual void <b><a href="qabstracteventdispatcher.html#registerSocketNotifier">registerSocketNotifier</a></b> ( QSocketNotifier * <i>notifier</i> ) = 0</li>
 
44
<li><div class="fn"/>int <b><a href="qabstracteventdispatcher.html#registerTimer">registerTimer</a></b> ( int <i>interval</i>, QObject * <i>object</i> )</li>
 
45
<li><div class="fn"/>virtual void <b><a href="qabstracteventdispatcher.html#registerTimer-2">registerTimer</a></b> ( int <i>timerId</i>, int <i>interval</i>, QObject * <i>object</i> ) = 0</li>
 
46
<li><div class="fn"/>virtual QList&lt;TimerInfo&gt; <b><a href="qabstracteventdispatcher.html#registeredTimers">registeredTimers</a></b> ( QObject * <i>object</i> ) const = 0</li>
 
47
<li><div class="fn"/>EventFilter <b><a href="qabstracteventdispatcher.html#setEventFilter">setEventFilter</a></b> ( EventFilter <i>filter</i> )</li>
 
48
<li><div class="fn"/>virtual void <b><a href="qabstracteventdispatcher.html#unregisterSocketNotifier">unregisterSocketNotifier</a></b> ( QSocketNotifier * <i>notifier</i> ) = 0</li>
 
49
<li><div class="fn"/>virtual bool <b><a href="qabstracteventdispatcher.html#unregisterTimer">unregisterTimer</a></b> ( int <i>timerId</i> ) = 0</li>
 
50
<li><div class="fn"/>virtual bool <b><a href="qabstracteventdispatcher.html#unregisterTimers">unregisterTimers</a></b> ( QObject * <i>object</i> ) = 0</li>
 
51
<li><div class="fn"/>virtual void <b><a href="qabstracteventdispatcher.html#wakeUp">wakeUp</a></b> () = 0</li>
 
52
</ul>
 
53
<ul>
 
54
<li><div class="fn"/>28 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
 
55
</ul>
 
56
<a name="signals"></a>
 
57
<h3>Signals</h3>
 
58
<ul>
 
59
<li><div class="fn"/>void <b><a href="qabstracteventdispatcher.html#aboutToBlock">aboutToBlock</a></b> ()</li>
 
60
<li><div class="fn"/>void <b><a href="qabstracteventdispatcher.html#awake">awake</a></b> ()</li>
 
61
</ul>
 
62
<ul>
 
63
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
 
64
</ul>
 
65
<a name="static-public-members"></a>
 
66
<h3>Static Public Members</h3>
 
67
<ul>
 
68
<li><div class="fn"/>QAbstractEventDispatcher * <b><a href="qabstracteventdispatcher.html#instance">instance</a></b> ( QThread * <i>thread</i> = 0 )</li>
 
69
</ul>
 
70
<ul>
 
71
<li><div class="fn"/>4 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
 
72
</ul>
 
73
<h3>Additional Inherited Members</h3>
 
74
<ul>
 
75
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
 
76
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
 
77
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
 
78
</ul>
 
79
<a name="details"></a>
 
80
<hr />
 
81
<h2>Detailed Description</h2>
 
82
<p>The QAbstractEventDispatcher class manages Qt's event queue, excluding GUI-related events.</p>
 
83
<p>It receives events from the window system and other sources. It then sends them to the <a href="qcoreapplication.html">QCoreApplication</a> or <a href="qapplication.html">QApplication</a> instance for processing and delivery. QAbstractEventDispatcher provides fine-grained control over event delivery.</p>
 
84
<p>For simple control of event processing use <a href="qcoreapplication.html#processEvents">QCoreApplication::processEvents</a>().</p>
 
85
<p>For finer control of the application's event loop, call <a href="qabstracteventdispatcher.html#instance">instance</a>() and call functions on the QAbstractEventDispatcher object that is returned. If you want to use your own instance of QAbstractEventDispatcher or of a QAbstractEventDispatcher subclass, you must create your instance <i>before</i> you create the <a href="qapplication.html">QApplication</a> object.</p>
 
86
<p>The main event loop is started by calling <a href="qcoreapplication.html#exec">QCoreApplication::exec</a>(), and stopped by calling <a href="qcoreapplication.html#exit">QCoreApplication::exit</a>(). Local event loops can be created using <a href="qeventloop.html">QEventLoop</a>.</p>
 
87
<p>Programs that perform long operations can call <a href="qabstracteventdispatcher.html#processEvents">processEvents</a>() with various <a href="qeventloop.html#ProcessEventsFlag-enum">QEventLoop::ProcessEventsFlag</a> values OR'ed together to control which events should be delivered.</p>
 
88
<p>QAbstractEventDispatcher also allows the integration of an external event loop with the Qt event loop. For example, the Motif Extension included with Qt includes a reimplementation of QAbstractEventDispatcher that merges Qt and Motif events together.</p>
 
89
<p>See also <a href="qeventloop.html">QEventLoop</a> and <a href="qcoreapplication.html">QCoreApplication</a>.</p>
 
90
<hr />
 
91
<h2>Member Type Documentation</h2>
 
92
<h3 class="fn"><a name="EventFilter-typedef"></a>typedef QAbstractEventDispatcher::EventFilter</h3>
 
93
<p>Typedef for a function with the signature</p>
 
94
<pre>&nbsp;   bool myEventFilter(void *message);</pre>
 
95
<p>See also <a href="qabstracteventdispatcher.html#setEventFilter">setEventFilter</a>() and <a href="qabstracteventdispatcher.html#filterEvent">filterEvent</a>().</p>
 
96
<h3 class="fn"><a name="TimerInfo-typedef"></a>typedef QAbstractEventDispatcher::TimerInfo</h3>
 
97
<p>Typedef for <a href="qpair.html">QPair</a>&lt;int, int&gt;. The first component of the pair is the timer ID; the second component is the interval.</p>
 
98
<p>See also <a href="qabstracteventdispatcher.html#registeredTimers">registeredTimers</a>().</p>
 
99
<hr />
 
100
<h2>Member Function Documentation</h2>
 
101
<h3 class="fn"><a name="QAbstractEventDispatcher"></a>QAbstractEventDispatcher::QAbstractEventDispatcher ( <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
 
102
<p>Constructs a new event dispatcher with the given <i>parent</i>.</p>
 
103
<h3 class="fn"><a name="dtor.QAbstractEventDispatcher"></a>QAbstractEventDispatcher::~QAbstractEventDispatcher ()</h3>
 
104
<p>Destroys the event dispatcher.</p>
 
105
<h3 class="fn"><a name="aboutToBlock"></a>void QAbstractEventDispatcher::aboutToBlock ()&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
106
<p>This signal is emitted before the event loop calls a function that could block.</p>
 
107
<p>See also <a href="qabstracteventdispatcher.html#awake">awake</a>().</p>
 
108
<h3 class="fn"><a name="awake"></a>void QAbstractEventDispatcher::awake ()&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
109
<p>This signal is emitted after the event loop returns from a function that could block.</p>
 
110
<p>See also <a href="qabstracteventdispatcher.html#wakeUp">wakeUp</a>() and <a href="qabstracteventdispatcher.html#aboutToBlock">aboutToBlock</a>().</p>
 
111
<h3 class="fn"><a name="filterEvent"></a>bool QAbstractEventDispatcher::filterEvent ( void * <i>message</i> )</h3>
 
112
<p>Sends <i>message</i> through the event filter that was set by <a href="qabstracteventdispatcher.html#setEventFilter">setEventFilter</a>(). If no event filter has been set, this function returns false; otherwise, this function returns the result of the event filter function.</p>
 
113
<p>Subclasses of <a href="qabstracteventdispatcher.html">QAbstractEventDispatcher</a> <i>must</i> call this function for <i>all</i> messages received from the system to ensure compatibility with any extensions that may be used in the application.</p>
 
114
<p>See also <a href="qabstracteventdispatcher.html#setEventFilter">setEventFilter</a>().</p>
 
115
<h3 class="fn"><a name="flush"></a>void QAbstractEventDispatcher::flush ()&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
 
116
<p>Flushes the event queue. This normally returns almost immediately. Does nothing on platforms other than <a href="winsystem.html#x11">X11</a>.</p>
 
117
<h3 class="fn"><a name="hasPendingEvents"></a>bool QAbstractEventDispatcher::hasPendingEvents ()&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
 
118
<p>Returns true if there is an event waiting; otherwise returns false.</p>
 
119
<h3 class="fn"><a name="instance"></a>QAbstractEventDispatcher * QAbstractEventDispatcher::instance ( <a href="qthread.html">QThread</a> * <i>thread</i> = 0 )&nbsp;&nbsp;<tt> [static]</tt></h3>
 
120
<p>Returns a pointer to the event dispatcher object for the specified <i>thread</i>. If <i>thread</i> is zero, the current thread is used. If no event dispatcher exists for the specified <i>thread</i>, this function returns 0.</p>
 
121
<p>Note: If Qt is built without thread support, the <i>thread</i> argument is ignored.</p>
 
122
<h3 class="fn"><a name="interrupt"></a>void QAbstractEventDispatcher::interrupt ()&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
 
123
<p>Interrupts event dispatching, i.e. the event dispatcher will return from <a href="qabstracteventdispatcher.html#processEvents">processEvents</a>() as soon as possible.</p>
 
124
<h3 class="fn"><a name="processEvents"></a>bool QAbstractEventDispatcher::processEvents ( <a href="qeventloop.html#ProcessEventsFlag-enum">QEventLoop::ProcessEventsFlags</a> <i>flags</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
 
125
<p>Processes pending events that match <i>flags</i> until there are no more events to process.</p>
 
126
<p>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 <a href="qeventloop.html#ProcessEventsFlag-enum">QEventLoop::ExcludeUserInputEvents</a> flag.</p>
 
127
<p>If the <a href="qeventloop.html#ProcessEventsFlag-enum">QEventLoop::WaitForMoreEvents</a> flag is set in <i>flags</i>, the behavior of this function is as follows:</p>
 
128
<ul>
 
129
<li>If events are available, this function returns after processing them.</li>
 
130
<li>If no events are available, this function will wait until more are available and return after processing newly available events.</li>
 
131
</ul>
 
132
<p>If the <a href="qeventloop.html#ProcessEventsFlag-enum">QEventLoop::WaitForMoreEvents</a> flag is not set in <i>flags</i>, and no events are available, this function will return immediately.</p>
 
133
<p>Note: This function does not process events continuously; it returns after all available events are processed.</p>
 
134
<p>This function returns true if an event was processed; otherwise it returns false.</p>
 
135
<p>See also <a href="qabstracteventdispatcher.html#hasPendingEvents">hasPendingEvents</a>().</p>
 
136
<h3 class="fn"><a name="registerSocketNotifier"></a>void QAbstractEventDispatcher::registerSocketNotifier ( <a href="qsocketnotifier.html">QSocketNotifier</a> * <i>notifier</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
 
137
<p>Registers <i>notifier</i> with the event loop. Subclasses must implement this method to tie a socket notifier into another event loop.</p>
 
138
<h3 class="fn"><a name="registerTimer"></a>int QAbstractEventDispatcher::registerTimer ( int <i>interval</i>, <a href="qobject.html">QObject</a> * <i>object</i> )</h3>
 
139
<p>Register a timer with the specified <i>interval</i> for the given <i>object</i>.</p>
 
140
<h3 class="fn"><a name="registerTimer-2"></a>void QAbstractEventDispatcher::registerTimer ( int <i>timerId</i>, int <i>interval</i>, <a href="qobject.html">QObject</a> * <i>object</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
 
141
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
142
<p>Register a timer with the specified <i>timerId</i> and <i>interval</i> for the given <i>object</i>.</p>
 
143
<h3 class="fn"><a name="registeredTimers"></a><a href="qlist.html">QList</a>&lt;<a href="qabstracteventdispatcher.html#TimerInfo-typedef">TimerInfo</a>&gt; QAbstractEventDispatcher::registeredTimers ( <a href="qobject.html">QObject</a> * <i>object</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
 
144
<p>Returns a list of registered timers for <i>object</i>. The timer ID is the first member in each pair; the interval is the second.</p>
 
145
<h3 class="fn"><a name="setEventFilter"></a><a href="qabstracteventdispatcher.html#EventFilter-typedef">EventFilter</a> QAbstractEventDispatcher::setEventFilter ( <a href="qabstracteventdispatcher.html#EventFilter-typedef">EventFilter</a> <i>filter</i> )</h3>
 
146
<p>Sets the event filter <i>filter</i>. Returns a pointer to the filter function previously defined.</p>
 
147
<p>The event filter is a function that receives all messages taken from the system event loop before the event is dispatched to the respective target. This includes messages that are not sent to Qt objects.</p>
 
148
<p>The function can return true to stop the event to be processed by Qt, or false to continue with the standard event processing.</p>
 
149
<p>Only one filter can be defined, but the filter can use the return value to call the previously set event filter. By default, no filter is set (i.e. the function returns 0).</p>
 
150
<h3 class="fn"><a name="unregisterSocketNotifier"></a>void QAbstractEventDispatcher::unregisterSocketNotifier ( <a href="qsocketnotifier.html">QSocketNotifier</a> * <i>notifier</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
 
151
<p>Unregisters <i>notifier</i> from the event dispatcher. Subclasses must reimplement this method to tie a socket notifier into another event loop. Reimplementations must call the base implementation.</p>
 
152
<h3 class="fn"><a name="unregisterTimer"></a>bool QAbstractEventDispatcher::unregisterTimer ( int <i>timerId</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
 
153
<p>Unregister the timer with the given <i>timerId</i>.</p>
 
154
<h3 class="fn"><a name="unregisterTimers"></a>bool QAbstractEventDispatcher::unregisterTimers ( <a href="qobject.html">QObject</a> * <i>object</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
 
155
<p>Unregister all the timers associated with the given <i>object</i>.</p>
 
156
<h3 class="fn"><a name="wakeUp"></a>void QAbstractEventDispatcher::wakeUp ()&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
 
157
<p>Wakes up the event loop.</p>
 
158
<p><b>Note:</b> This function is <a href="threads.html#thread-safe">thread-safe</a>.</p>
 
159
<p>See also <a href="qabstracteventdispatcher.html#awake">awake</a>().</p>
 
160
<p /><address><hr /><div align="center">
 
161
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
162
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
163
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
164
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
165
</tr></table></div></address></body>
 
166
</html>