File: qeventloop.html

package info (click to toggle)
python-qt4 4.12.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 40,300 kB
  • ctags: 6,185
  • sloc: python: 125,988; cpp: 13,291; xml: 292; makefile: 246; php: 27; sh: 2
file content (138 lines) | stat: -rw-r--r-- 11,004 bytes parent folder | download
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
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QEventLoop Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QEventLoop Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QEventLoop class provides a means of entering and leaving an
event loop. <a href="#details">More...</a></p>

<p>Inherits <a href="qobject.html">QObject</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qeventloop.html#ProcessEventsFlag-enum">ProcessEventsFlag</a></b> { AllEvents, ExcludeUserInputEvents, ExcludeSocketNotifiers, WaitForMoreEvents, X11ExcludeTimers, DeferredDeletion }</li><li><div class="fn" />class <b><a href="qeventloop-processeventsflags.html">ProcessEventsFlags</a></b></li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qeventloop.html#QEventLoop">__init__</a></b> (<i>self</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />int <b><a href="qeventloop.html#exec">exec_</a></b> (<i>self</i>, ProcessEventsFlags&#160;<i>flags</i>&#160;=&#160;QEventLoop.AllEvents)</li><li><div class="fn" /><b><a href="qeventloop.html#exit">exit</a></b> (<i>self</i>, int&#160;<i>returnCode</i>&#160;=&#160;0)</li><li><div class="fn" />bool <b><a href="qeventloop.html#isRunning">isRunning</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qeventloop.html#processEvents">processEvents</a></b> (<i>self</i>, ProcessEventsFlags&#160;<i>flags</i>&#160;=&#160;QEventLoop.AllEvents)</li><li><div class="fn" /><b><a href="qeventloop.html#processEvents-2">processEvents</a></b> (<i>self</i>, ProcessEventsFlags&#160;<i>flags</i>, int&#160;<i>maximumTime</i>)</li><li><div class="fn" /><b><a href="qeventloop.html#quit">quit</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qeventloop.html#wakeUp">wakeUp</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QEventLoop class provides a means of entering and leaving an
event loop.</p>
<p>At any time, you can create a QEventLoop object and call
<a href="qeventloop.html#exec">exec_</a>() on it to start a local
event loop. From within the event loop, calling <a href="qeventloop.html#exit">exit</a>() will force <a href="qeventloop.html#exec">exec_</a>() to return.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="ProcessEventsFlag-enum" />QEventLoop.ProcessEventsFlag</h3><p>This enum controls the types of events processed by the <a href="qeventloop.html#processEvents">processEvents</a>() functions.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QEventLoop.AllEvents</tt></td>
<td class="topAlign"><tt>0x00</tt></td>
<td class="topAlign">All events. Note that <a href="qevent.html#Type-enum">DeferredDelete</a> events are processed
specially. See <a href="qobject.html#deleteLater">QObject.deleteLater</a>() for more
details.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QEventLoop.ExcludeUserInputEvents</tt></td>
<td class="topAlign"><tt>0x01</tt></td>
<td class="topAlign">Do not process user input events, such as
ButtonPress and KeyPress. Note that the events are not discarded;
they will be delivered the next time <a href="qeventloop.html#processEvents">processEvents</a>() is called
without the ExcludeUserInputEvents flag.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QEventLoop.ExcludeSocketNotifiers</tt></td>
<td class="topAlign"><tt>0x02</tt></td>
<td class="topAlign">Do not process socket notifier events. Note
that the events are not discarded; they will be delivered the next
time <a href="qeventloop.html#processEvents">processEvents</a>() is
called without the ExcludeSocketNotifiers flag.</td>
</tr>
<tr>
<td class="topAlign"><tt>QEventLoop.WaitForMoreEvents</tt></td>
<td class="topAlign"><tt>0x04</tt></td>
<td class="topAlign">Wait for events if no pending events are
available.</td>
</tr>
<tr>
<td class="topAlign"><tt>QEventLoop.DeferredDeletion</tt></td>
<td class="topAlign"><tt>0x10</tt></td>
<td class="topAlign">deprecated - do not use.</td>
</tr>
</table>
<p>The ProcessEventsFlags type is a typedef for <a href="qflags.html">QFlags</a>&lt;ProcessEventsFlag&gt;. It stores an OR
combination of ProcessEventsFlag values.</p>
<p><b>See also</b> <a href="qeventloop.html#processEvents">processEvents</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QEventLoop" />QEventLoop.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs an event loop object with the given
<i>parent</i>.</p>


<h3 class="fn"><a name="exec" />int QEventLoop.exec_ (<i>self</i>, <a href="qeventloop-processeventsflags.html">ProcessEventsFlags</a>&#160;<i>flags</i>&#160;=&#160;QEventLoop.AllEvents)</h3><p>Enters the main event loop and waits until <a href="qeventloop.html#exit">exit</a>() is called. Returns the value that
was passed to <a href="qeventloop.html#exit">exit</a>().</p>
<p>If <i>flags</i> are specified, only events of the types allowed
by the <i>flags</i> will be processed.</p>
<p>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.</p>
<p>Generally speaking, no user interaction can take place before
calling exec(). As a special case, modal widgets like <a href="qmessagebox.html">QMessageBox</a> can be used before calling
exec(), because modal widgets use their own local event loop.</p>
<p>To make your application perform idle processing (i.e. executing
a special function whenever there are no pending events), use a
<a href="qtimer.html">QTimer</a> with 0 timeout. More sophisticated
idle processing schemes can be achieved using <a href="qeventloop.html#processEvents">processEvents</a>().</p>
<p><b>See also</b> <a href="qcoreapplication.html#quit">QApplication.quit</a>(), <a href="qeventloop.html#exit">exit</a>(), and <a href="qeventloop.html#processEvents">processEvents</a>().</p>


<h3 class="fn"><a name="exit" />QEventLoop.exit (<i>self</i>, int&#160;<i>returnCode</i>&#160;=&#160;0)</h3><p>Tells the event loop to exit with a return code.</p>
<p>After this function has been called, the event loop returns from
the call to <a href="qeventloop.html#exec">exec_</a>(). The <a href="qeventloop.html#exec">exec_</a>() function returns
<i>returnCode</i>.</p>
<p>By convention, a <i>returnCode</i> of 0 means success, and any
non-zero value indicates an error.</p>
<p>Note that unlike the C library function of the same name, this
function <i>does</i> return to the caller -- it is event processing
that stops.</p>
<p><b>See also</b> <a href="qcoreapplication.html#quit">QCoreApplication.quit</a>(), <a href="qeventloop.html#quit">quit</a>(), and <a href="qeventloop.html#exec">exec_</a>().</p>


<h3 class="fn"><a name="isRunning" />bool QEventLoop.isRunning (<i>self</i>)</h3><p>Returns true if the event loop is running; otherwise returns
false. The event loop is considered running from the time when
<a href="qeventloop.html#exec">exec_</a>() is called until <a href="qeventloop.html#exit">exit</a>() is called.</p>
<p><b>See also</b> <a href="qeventloop.html#exec">exec_</a>() and
<a href="qeventloop.html#exit">exit</a>().</p>


<h3 class="fn"><a name="processEvents" />bool QEventLoop.processEvents (<i>self</i>, <a href="qeventloop-processeventsflags.html">ProcessEventsFlags</a>&#160;<i>flags</i>&#160;=&#160;QEventLoop.AllEvents)</h3><p>Processes pending events that match <i>flags</i> until there are
no more events to process. Returns true if pending events were
handled; otherwise returns false.</p>
<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">ExcludeUserInputEvents</a>
flag.</p>
<p>This function is simply a wrapper for <a href="qabstracteventdispatcher.html#processEvents">QAbstractEventDispatcher.processEvents</a>().
See the documentation for that function for details.</p>


<h3 class="fn"><a name="processEvents-2" />QEventLoop.processEvents (<i>self</i>, <a href="qeventloop-processeventsflags.html">ProcessEventsFlags</a>&#160;<i>flags</i>, int&#160;<i>maximumTime</i>)</h3><p>Process pending events that match <i>flags</i> for a maximum of
<i>maxTime</i> milliseconds, or until there are no more events to
process, whichever is shorter. 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">ExcludeUserInputEvents</a>
flag.</p>
<p><b>Notes:</b></p>
<ul>
<li>This function does not process events continuously; it returns
after all available events are processed.</li>
<li>Specifying the <a href="qeventloop.html#ProcessEventsFlag-enum">WaitForMoreEvents</a> flag
makes no sense and will be ignored.</li>
</ul>


<h3 class="fn"><a name="quit" />QEventLoop.quit (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void quit()</tt>.</p><p>Tells the event loop to exit normally.</p>
<p>Same as exit(0).</p>
<p><b>See also</b> <a href="qcoreapplication.html#quit">QCoreApplication.quit</a>() and
<a href="qeventloop.html#exit">exit</a>().</p>


<h3 class="fn"><a name="wakeUp" />QEventLoop.wakeUp (<i>self</i>)</h3><p>Wakes up the event loop.</p>
<p><b>See also</b> <a href="qabstracteventdispatcher.html#wakeUp">QAbstractEventDispatcher.wakeUp</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.12.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt&#160;4.8.7</td></tr></table></div></address></body></html>