PageRenderTime 42ms CodeModel.GetById 11ms RepoModel.GetById 1ms app.codeStats 0ms

/PyQt-x11-gpl-4.9.4/doc/html/qeventloop.html

#
HTML | 138 lines | 123 code | 15 blank | 0 comment | 0 complexity | 15d904b1ab0b69597887190fc43fcc04 MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0
  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
  3. <html><head><title>QEventLoop Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
  4. a:link { color: #004faf; text-decoration: none }
  5. a:visited { color: #672967; text-decoration: none }
  6. td.postheader { font-family: sans-serif }
  7. tr.address { font-family: sans-serif }
  8. body { background: #ffffff; color: black; }
  9. </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
  10. event loop. <a href="#details">More...</a></p>
  11. <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
  12. event loop.</p>
  13. <p>At any time, you can create a QEventLoop object and call
  14. <a href="qeventloop.html#exec">exec_</a>() on it to start a local
  15. 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>
  16. <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>
  17. <table class="valuelist">
  18. <tr class="odd" valign="top">
  19. <th class="tblConst">Constant</th>
  20. <th class="tblval">Value</th>
  21. <th class="tbldscr">Description</th>
  22. </tr>
  23. <tr>
  24. <td class="topAlign"><tt>QEventLoop.AllEvents</tt></td>
  25. <td class="topAlign"><tt>0x00</tt></td>
  26. <td class="topAlign">All events. Note that <a href="qevent.html#Type-enum">DeferredDelete</a> events are processed
  27. specially. See <a href="qobject.html#deleteLater">QObject.deleteLater</a>() for more
  28. details.</td>
  29. </tr>
  30. <tr>
  31. <td class="topAlign">
  32. <tt>QEventLoop.ExcludeUserInputEvents</tt></td>
  33. <td class="topAlign"><tt>0x01</tt></td>
  34. <td class="topAlign">Do not process user input events, such as
  35. ButtonPress and KeyPress. Note that the events are not discarded;
  36. they will be delivered the next time <a href="qeventloop.html#processEvents">processEvents</a>() is called
  37. without the ExcludeUserInputEvents flag.</td>
  38. </tr>
  39. <tr>
  40. <td class="topAlign">
  41. <tt>QEventLoop.ExcludeSocketNotifiers</tt></td>
  42. <td class="topAlign"><tt>0x02</tt></td>
  43. <td class="topAlign">Do not process socket notifier events. Note
  44. that the events are not discarded; they will be delivered the next
  45. time <a href="qeventloop.html#processEvents">processEvents</a>() is
  46. called without the ExcludeSocketNotifiers flag.</td>
  47. </tr>
  48. <tr>
  49. <td class="topAlign"><tt>QEventLoop.WaitForMoreEvents</tt></td>
  50. <td class="topAlign"><tt>0x04</tt></td>
  51. <td class="topAlign">Wait for events if no pending events are
  52. available.</td>
  53. </tr>
  54. <tr>
  55. <td class="topAlign"><tt>QEventLoop.DeferredDeletion</tt></td>
  56. <td class="topAlign"><tt>0x10</tt></td>
  57. <td class="topAlign">deprecated - do not use.</td>
  58. </tr>
  59. </table>
  60. <p>The ProcessEventsFlags type is a typedef for <a href="qflags.html">QFlags</a>&lt;ProcessEventsFlag&gt;. It stores an OR
  61. combination of ProcessEventsFlag values.</p>
  62. <p><b>See also</b> <a href="qeventloop.html#processEvents">processEvents</a>().</p>
  63. <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
  64. <i>parent</i>.</p>
  65. <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
  66. was passed to <a href="qeventloop.html#exit">exit</a>().</p>
  67. <p>If <i>flags</i> are specified, only events of the types allowed
  68. by the <i>flags</i> will be processed.</p>
  69. <p>It is necessary to call this function to start event handling.
  70. The main event loop receives events from the window system and
  71. dispatches these to the application widgets.</p>
  72. <p>Generally speaking, no user interaction can take place before
  73. calling exec(). As a special case, modal widgets like <a href="qmessagebox.html">QMessageBox</a> can be used before calling
  74. exec(), because modal widgets use their own local event loop.</p>
  75. <p>To make your application perform idle processing (i.e. executing
  76. a special function whenever there are no pending events), use a
  77. <a href="qtimer.html">QTimer</a> with 0 timeout. More sophisticated
  78. idle processing schemes can be achieved using <a href="qeventloop.html#processEvents">processEvents</a>().</p>
  79. <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>
  80. <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>
  81. <p>After this function has been called, the event loop returns from
  82. the call to <a href="qeventloop.html#exec">exec_</a>(). The <a href="qeventloop.html#exec">exec_</a>() function returns
  83. <i>returnCode</i>.</p>
  84. <p>By convention, a <i>returnCode</i> of 0 means success, and any
  85. non-zero value indicates an error.</p>
  86. <p>Note that unlike the C library function of the same name, this
  87. function <i>does</i> return to the caller -- it is event processing
  88. that stops.</p>
  89. <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>
  90. <h3 class="fn"><a name="isRunning" />bool QEventLoop.isRunning (<i>self</i>)</h3><p>Returns true if the event loop is running; otherwise returns
  91. false. The event loop is considered running from the time when
  92. <a href="qeventloop.html#exec">exec_</a>() is called until <a href="qeventloop.html#exit">exit</a>() is called.</p>
  93. <p><b>See also</b> <a href="qeventloop.html#exec">exec_</a>() and
  94. <a href="qeventloop.html#exit">exit</a>().</p>
  95. <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
  96. no more events to process. Returns true if pending events were
  97. handled; otherwise returns false.</p>
  98. <p>This function is especially useful if you have a long running
  99. operation and want to show its progress without allowing user
  100. input; i.e. by using the <a href="qeventloop.html#ProcessEventsFlag-enum">ExcludeUserInputEvents</a>
  101. flag.</p>
  102. <p>This function is simply a wrapper for <a href="qabstracteventdispatcher.html#processEvents">QAbstractEventDispatcher.processEvents</a>().
  103. See the documentation for that function for details.</p>
  104. <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
  105. <i>maxTime</i> milliseconds, or until there are no more events to
  106. process, whichever is shorter. This function is especially useful
  107. if you have a long running operation and want to show its progress
  108. without allowing user input, i.e. by using the <a href="qeventloop.html#ProcessEventsFlag-enum">ExcludeUserInputEvents</a>
  109. flag.</p>
  110. <p><b>Notes:</b></p>
  111. <ul>
  112. <li>This function does not process events continuously; it returns
  113. after all available events are processed.</li>
  114. <li>Specifying the <a href="qeventloop.html#ProcessEventsFlag-enum">WaitForMoreEvents</a> flag
  115. makes no sense and will be ignored.</li>
  116. </ul>
  117. <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>
  118. <p>Same as exit(0).</p>
  119. <p><b>See also</b> <a href="qcoreapplication.html#quit">QCoreApplication.quit</a>() and
  120. <a href="qeventloop.html#exit">exit</a>().</p>
  121. <h3 class="fn"><a name="wakeUp" />QEventLoop.wakeUp (<i>self</i>)</h3><p>Wakes up the event loop.</p>
  122. <p><b>See also</b> <a href="qabstracteventdispatcher.html#wakeUp">QAbstractEventDispatcher.wakeUp</a>().</p>
  123. <address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.4 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.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.2</td></tr></table></div></address></body></html>