File: qcoreapplication.html

package info (click to toggle)
python-qt4 4.0.1-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 18,632 kB
  • ctags: 2,639
  • sloc: python: 29,409; sh: 5,646; cpp: 3,168; xml: 149; makefile: 109
file content (156 lines) | stat: -rw-r--r-- 33,700 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<?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>QCoreApplication 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="../pyqt4ref.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">QCoreApplication Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QCoreApplication class provides an event loop for console Qt applications. <a href="#details">More...</a></p>
<p>Inherits <a href="qobject.html">QObject</a>.</p><p>Inherited by <a href="qapplication.html">QApplication</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qcoreapplication.html#Encoding-enum">Encoding</a></b> { DefaultCodec, UnicodeUTF8 }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qcoreapplication.html#QCoreApplication">__init__</a></b> (<i>self</i>, list&#160;<i>argv</i>)</li><li><div class="fn" />bool <b><a href="qcoreapplication.html#event">event</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" />bool <b><a href="qcoreapplication.html#notify">notify</a></b> (<i>self</i>, QObject, QEvent)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" /><b><a href="qcoreapplication.html#addLibraryPath">addLibraryPath</a></b> (QString)</li><li><div class="fn" />QString <b><a href="qcoreapplication.html#applicationDirPath">applicationDirPath</a></b> ()</li><li><div class="fn" />QString <b><a href="qcoreapplication.html#applicationFilePath">applicationFilePath</a></b> ()</li><li><div class="fn" />QString <b><a href="qcoreapplication.html#applicationName">applicationName</a></b> ()</li><li><div class="fn" />int <b><a href="qcoreapplication.html#argc">argc</a></b> ()</li><li><div class="fn" />QStringList <b><a href="qcoreapplication.html#arguments">arguments</a></b> ()</li><li><div class="fn" />list <b><a href="qcoreapplication.html#argv">argv</a></b> ()</li><li><div class="fn" />bool <b><a href="qcoreapplication.html#closingDown">closingDown</a></b> ()</li><li><div class="fn" />int <b><a href="qcoreapplication.html#exec">exec_</a></b> ()</li><li><div class="fn" /><b><a href="qcoreapplication.html#exit">exit</a></b> (int&#160;<i>retcode</i>&#160;=&#160;0)</li><li><div class="fn" /><b><a href="qcoreapplication.html#flush">flush</a></b> ()</li><li><div class="fn" />bool <b><a href="qcoreapplication.html#hasPendingEvents">hasPendingEvents</a></b> ()</li><li><div class="fn" /><b><a href="qcoreapplication.html#installTranslator">installTranslator</a></b> (QTranslator)</li><li><div class="fn" />QCoreApplication <b><a href="qcoreapplication.html#instance">instance</a></b> ()</li><li><div class="fn" />QStringList <b><a href="qcoreapplication.html#libraryPaths">libraryPaths</a></b> ()</li><li><div class="fn" />QString <b><a href="qcoreapplication.html#organizationDomain">organizationDomain</a></b> ()</li><li><div class="fn" />QString <b><a href="qcoreapplication.html#organizationName">organizationName</a></b> ()</li><li><div class="fn" /><b><a href="qcoreapplication.html#postEvent">postEvent</a></b> (QObject&#160;<i>receiver</i>, QEvent&#160;<i>event</i>)</li><li><div class="fn" /><b><a href="qcoreapplication.html#processEvents">processEvents</a></b> (QEventLoop.ProcessEventsFlags&#160;<i>flags</i>&#160;=&#160;QEventLoop.AllEvents)</li><li><div class="fn" /><b><a href="qcoreapplication.html#processEvents-2">processEvents</a></b> (QEventLoop.ProcessEventsFlags&#160;<i>flags</i>, int&#160;<i>maxtime</i>)</li><li><div class="fn" /><b><a href="qcoreapplication.html#quit">quit</a></b> ()</li><li><div class="fn" /><b><a href="qcoreapplication.html#removeLibraryPath">removeLibraryPath</a></b> (QString)</li><li><div class="fn" /><b><a href="qcoreapplication.html#removePostedEvents">removePostedEvents</a></b> (QObject&#160;<i>receiver</i>)</li><li><div class="fn" /><b><a href="qcoreapplication.html#removeTranslator">removeTranslator</a></b> (QTranslator)</li><li><div class="fn" />bool <b><a href="qcoreapplication.html#sendEvent">sendEvent</a></b> (QObject&#160;<i>receiver</i>, QEvent&#160;<i>event</i>)</li><li><div class="fn" /><b><a href="qcoreapplication.html#sendPostedEvents">sendPostedEvents</a></b> (QObject&#160;<i>receiver</i>, int&#160;<i>event_type</i>)</li><li><div class="fn" /><b><a href="qcoreapplication.html#sendPostedEvents-2">sendPostedEvents</a></b> ()</li><li><div class="fn" /><b><a href="qcoreapplication.html#setApplicationName">setApplicationName</a></b> (QString&#160;<i>application</i>)</li><li><div class="fn" /><b><a href="qcoreapplication.html#setLibraryPaths">setLibraryPaths</a></b> (QStringList)</li><li><div class="fn" /><b><a href="qcoreapplication.html#setOrganizationDomain">setOrganizationDomain</a></b> (QString&#160;<i>orgDomain</i>)</li><li><div class="fn" /><b><a href="qcoreapplication.html#setOrganizationName">setOrganizationName</a></b> (QString&#160;<i>orgName</i>)</li><li><div class="fn" />bool <b><a href="qcoreapplication.html#startingUp">startingUp</a></b> ()</li><li><div class="fn" />QString <b><a href="qcoreapplication.html#translate">translate</a></b> (str&#160;<i>context</i>, str&#160;<i>key</i>, str&#160;<i>comment</i>&#160;=&#160;None, Encoding&#160;<i>encoding</i>&#160;=&#160;QCoreApplication.DefaultCodec)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qcoreapplication.html#aboutToQuit">aboutToQuit</a></b> ()</li><li><div class="fn" />void <b><a href="qcoreapplication.html#unixSignal">unixSignal</a></b> (int)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QCoreApplication class provides an event loop for console Qt applications.</p>
<p>This class is used by non-GUI applications to provide their event loop. For non-GUI application that uses Qt, there should be exactly one QCoreApplication object. For GUI applications, see <a href="qapplication.html">QApplication</a>.</p>
<p>QCoreApplication contains the main event loop, where all events from the operating system (e.g., timer and network events) and other sources are processed and dispatched. It also handles the application's initialization and finalization, as well as system-wide and application-wide settings.</p>
<p>The command line arguments which QCoreApplication's constructor should be called with are accessible using <a href="qcoreapplication-obsolete.html#argc">argc</a>() and <a href="qcoreapplication-obsolete.html#argv">argv</a>(). The event loop is started with a call to <a href="qcoreapplication.html#exec">exec_</a>(). Long running operations can call <a href="qcoreapplication.html#processEvents">processEvents</a>() to keep the application responsive.</p>
<p>Some Qt classes (e.g., <a href="qstring.html">QString</a>) can be used without a QCoreApplication object. However, in general, we recommend that you create a QCoreApplication or a <a href="qapplication.html">QApplication</a> object in your <tt>main()</tt> function as early as possible.</p>
<p>An application has an <a href="qcoreapplication.html#applicationDirPath">applicationDirPath</a>() and an <a href="qcoreapplication.html#applicationFilePath">applicationFilePath</a>(). Translation files can be added or removed using <a href="qcoreapplication.html#installTranslator">installTranslator</a>() and <a href="qcoreapplication.html#removeTranslator">removeTranslator</a>(). Application strings can be translated using <a href="qcoreapplication.html#translate">translate</a>(). The <a href="qobject.html#tr">QObject.tr</a>() and <a href="qobject.html#trUtf8">QObject.trUtf8</a>() functions are implemented in terms of <a href="qcoreapplication.html#translate">translate</a>().</p>
<p>The class provides a <a href="qcoreapplication.html#quit">quit</a>() slot and an <a href="qcoreapplication.html#aboutToQuit">aboutToQuit</a>() signal.</p>
<p>Several static convenience functions are also provided. The QCoreApplication object is available from <a href="qcoreapplication.html#instance">instance</a>(). Events can be sent or posted using <a href="qcoreapplication.html#sendEvent">sendEvent</a>(), <a href="qcoreapplication.html#postEvent">postEvent</a>(), and <a href="qcoreapplication.html#sendPostedEvents">sendPostedEvents</a>(). Pending events can be removed with <a href="qcoreapplication.html#removePostedEvents">removePostedEvents</a>() or flushed with <a href="qcoreapplication.html#flush">flush</a>(). Library paths (see <a href="qlibrary.html">QLibrary</a>) can be retrieved with <a href="qcoreapplication.html#libraryPaths">libraryPaths</a>() and manipulated by <a href="qcoreapplication.html#setLibraryPaths">setLibraryPaths</a>(), <a href="qcoreapplication.html#addLibraryPath">addLibraryPath</a>(), and <a href="qcoreapplication.html#removeLibraryPath">removeLibraryPath</a>().</p>
<p>See also <a href="qapplication.html">QApplication</a>, <a href="qabstracteventdispatcher.html">QAbstractEventDispatcher</a>, and <a href="qeventloop.html">QEventLoop</a>.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="Encoding-enum" />QCoreApplication.Encoding</h3><p>This enum type defines the 8-bit encoding of character string arguments to <a href="qcoreapplication.html#translate">translate</a>():</p>
<table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr>
<th width="25%">Constant</th>
<th width="15%">Value</th>
<th width="60%">Description</th>
</tr>
<tr>
<td valign="top"><tt>QCoreApplication.DefaultCodec</tt></td>
<td align="center" valign="top"><tt>0</tt></td>
<td valign="top">The encoding specified by <a href="qtextcodec.html#codecForTr">QTextCodec.codecForTr</a>() (Latin1 if none has been set)</td>
</tr>
<tr>
<td valign="top"><tt>QCoreApplication.UnicodeUTF8</tt></td>
<td align="center" valign="top"><tt>1</tt></td>
<td valign="top">UTF-8</td>
</tr>
</table>
<br />
<br />
<p>See also <a href="qobject.html#tr">QObject.tr</a>(), <a href="qobject.html#trUtf8">QObject.trUtf8</a>(), and <a href="qstring.html#fromUtf8">QString.fromUtf8</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QCoreApplication" />QCoreApplication.__init__ (<i>self</i>, list&#160;<i>argv</i>)</h3><p>Constructs a Qt kernel application. Kernel applications are applications without a graphical user interface. These type of applications are used at the console or as server processes.</p>
<p>The <i>argc</i> and <i>argv</i> arguments are processed by the application, and made available in a more convenient form by the <a href="qcoreapplication.html#arguments">arguments</a>() function.</p>
<h3 class="fn"><a name="addLibraryPath" />QCoreApplication.addLibraryPath (<a href="qstring.html">QString</a>)</h3><p>Appends <i>path</i> to the end of the library path list. If <i>path</i> is empty or already in the path list, the path list is not changed.</p>
<p>The default path list consists of a single entry, the installation directory for plugins. The default installation directory for plugins is <tt>INSTALL/plugins</tt>, where <tt>INSTALL</tt> is the directory where Qt was installed.</p>
<p>See also <a href="qcoreapplication.html#removeLibraryPath">removeLibraryPath</a>(), <a href="qcoreapplication.html#libraryPaths">libraryPaths</a>(), and <a href="qcoreapplication.html#setLibraryPaths">setLibraryPaths</a>().</p>
<h3 class="fn"><a name="applicationDirPath" /><a href="qstring.html">QString</a> QCoreApplication.applicationDirPath ()</h3><p>Returns the directory that contains the application executable.</p>
<p>For example, if you have installed Qt in the <tt>C:\Trolltech\Qt</tt> directory, and you run the <tt>regexp</tt> example, this function will return "C:/Trolltech/Qt/examples/tools/regexp".</p>
<p>On Mac OS X this will point to the directory actually containing the executable, which may be inside of an application bundle (if the application is bundled).</p>
<p><b>Warning:</b> On Unix, this function assumes that argv[0] contains the file name of the executable (which it normally does). It also assumes that the current directory hasn't been changed by the application.</p>
<p>See also <a href="qcoreapplication.html#applicationFilePath">applicationFilePath</a>().</p>
<h3 class="fn"><a name="applicationFilePath" /><a href="qstring.html">QString</a> QCoreApplication.applicationFilePath ()</h3><p>Returns the file path of the application executable.</p>
<p>For example, if you have installed Qt in the <tt>/usr/local/qt</tt> directory, and you run the <tt>regexp</tt> example, this function will return "/usr/local/qt/examples/tools/regexp/regexp".</p>
<p><b>Warning:</b> On Unix, this function assumes that argv[0] contains the file name of the executable (which it normally does). It also assumes that the current directory hasn't been changed by the application.</p>
<p>See also <a href="qcoreapplication.html#applicationDirPath">applicationDirPath</a>().</p>
<h3 class="fn"><a name="applicationName" /><a href="qstring.html">QString</a> QCoreApplication.applicationName ()</h3><h3 class="fn"><a name="argc" />int QCoreApplication.argc ()</h3><h3 class="fn"><a name="arguments" /><a href="qstringlist.html">QStringList</a> QCoreApplication.arguments ()</h3><p>Returns the list of command-line arguments.</p>
<p>arguments().at(0) is the program name, arguments().at(1) is the first argument, and arguments().last() is the last argument.</p>
<p>Calling this function is slow - you should store the result in a variable when parsing the command line.</p>
<p><b>Warning:</b> On Unix, this list is built from the argc and argv parameters passed to the constructor in the main() function. The string-data in argv is interpreted using <a href="qstring.html#fromLocal8Bit">QString.fromLocal8Bit</a>(); hence it is not possible to pass i.e. Japanese command line arguments on a system that runs in a latin1 locale. Most modern Unix systems do not have this limitation, as they are Unicode based.</p>
<p>On NT-based Windows, this limitation does not apply either.</p>
<p>This function was introduced in Qt 4.1.</p>
<h3 class="fn"><a name="argv" />list QCoreApplication.argv ()</h3><h3 class="fn"><a name="closingDown" />bool QCoreApplication.closingDown ()</h3><p>Returns true if the application objects are being destroyed; otherwise returns false.</p>
<p>See also <a href="qcoreapplication.html#startingUp">startingUp</a>().</p>
<h3 class="fn"><a name="event" />bool QCoreApplication.event (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><h3 class="fn"><a name="exec" />int QCoreApplication.exec_ ()</h3><p>Enters the main event loop and waits until <a href="qcoreapplication.html#exit">exit</a>() is called. Returns the value that was set to <a href="qcoreapplication.html#exit">exit</a>() (which is 0 if <a href="qcoreapplication.html#exit">exit</a>() is called via <a href="qcoreapplication.html#quit">quit</a>()).</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>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 advanced idle processing schemes can be achieved using <a href="qcoreapplication.html#processEvents">processEvents</a>().</p>
<p>See also <a href="qcoreapplication.html#quit">quit</a>(), <a href="qcoreapplication.html#exit">exit</a>(), <a href="qcoreapplication.html#processEvents">processEvents</a>(), and <a href="qapplication.html#exec">QApplication.exec</a>().</p>
<h3 class="fn"><a name="exit" />QCoreApplication.exit (int&#160;<i>retcode</i>&#160;=&#160;0)</h3><p>Tells the application to exit with a return code.</p>
<p>After this function has been called, the application leaves the main event loop and returns from the call to <a href="qcoreapplication.html#exec">exec_</a>(). The <a href="qcoreapplication.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>See also <a href="qcoreapplication.html#quit">quit</a>() and <a href="qcoreapplication.html#exec">exec_</a>().</p>
<h3 class="fn"><a name="flush" />QCoreApplication.flush ()</h3><p>Flushes the platform specific event queues.</p>
<p>If you are doing graphical changes inside a loop that does not return to the event loop on asynchronous window systems like X11 or double buffered window systems like Mac OS X, and you want to visualize these changes immediately (e.g. Splash Screens), call this function.</p>
<p>See also <a href="qcoreapplication.html#sendPostedEvents">sendPostedEvents</a>().</p>
<h3 class="fn"><a name="hasPendingEvents" />bool QCoreApplication.hasPendingEvents ()</h3><p>This function returns true if there are pending events; otherwise returns false. Pending events can be either from the window system or posted events using <a href="qcoreapplication.html#postEvent">postEvent</a>().</p>
<p>See also <a href="qabstracteventdispatcher.html#hasPendingEvents">QAbstractEventDispatcher.hasPendingEvents</a>().</p>
<h3 class="fn"><a name="installTranslator" />QCoreApplication.installTranslator (<a href="qtranslator.html">QTranslator</a>)</h3><p>Adds the message file <i>messageFile</i> to the list of message files to be used for translations.</p>
<p>Multiple message files can be installed. Translations are searched for in the last installed message file, then the one from last, and so on, back to the first installed message file. The search stops as soon as a matching translation is found.</p>
<p>See also <a href="qcoreapplication.html#removeTranslator">removeTranslator</a>(), <a href="qcoreapplication.html#translate">translate</a>(), and <a href="qtranslator.html#load">QTranslator.load</a>().</p>
<h3 class="fn"><a name="instance" /><a href="qcoreapplication.html">QCoreApplication</a> QCoreApplication.instance ()</h3><p>Returns a pointer to the application's <a href="qcoreapplication.html">QCoreApplication</a> (or <a href="qapplication.html">QApplication</a>) instance.</p>
<h3 class="fn"><a name="libraryPaths" /><a href="qstringlist.html">QStringList</a> QCoreApplication.libraryPaths ()</h3><p>Returns a list of paths that the application will search when dynamically loading libraries.</p>
<p>This list will include the installation directory for plugins if it exists (the default installation directory for plugins is <tt>INSTALL/plugins</tt>, where <tt>INSTALL</tt> is the directory where Qt was installed). The directory of the application executable (NOT the working directory) is always added, as well as the colon separated entries of the QT_PLUGIN_PATH environment variable.</p>
<p>If you want to iterate over the list, you can use the <a href="containers.html#foreach">foreach</a> pseudo-keyword:</p>
<pre>
    foreach (QString path, app.libraryPaths())
        do_something(path);
</pre>
<p>See also <a href="qcoreapplication.html#setLibraryPaths">setLibraryPaths</a>(), <a href="qcoreapplication.html#addLibraryPath">addLibraryPath</a>(), <a href="qcoreapplication.html#removeLibraryPath">removeLibraryPath</a>(), <a href="qlibrary.html">QLibrary</a>, and <a href="plugins-howto.html">How to Create Qt Plugins</a>.</p>
<h3 class="fn"><a name="notify" />bool QCoreApplication.notify (<i>self</i>, <a href="qobject.html">QObject</a>, <a href="qevent.html">QEvent</a>)</h3><p>Sends <i>event</i> to <i>receiver</i>: <i>receiver</i>-&gt;event(<i>event</i>). Returns the value that is returned from the receiver's event handler.</p>
<p>For certain types of events (e.g. mouse and key events), the event will be propagated to the receiver's parent and so on up to the top-level object if the receiver is not interested in the event (i.e., it returns false).</p>
<p>There are five different ways that events can be processed; reimplementing this virtual function is just one of them. All five approaches are listed below:</p>
<ol type="1">
<li>Reimplementing paintEvent(), mousePressEvent() and so on. This is the commonest, easiest and least powerful way.</li>
<li>Reimplementing this function. This is very powerful, providing complete control; but only one subclass can be active at a time.</li>
<li>Installing an event filter on <a href="qcoreapplication.html#instance">QCoreApplication.instance</a>(). Such an event filter is able to process all events for all widgets, so it's just as powerful as reimplementing notify(); furthermore, it's possible to have more than one application-global event filter. Global event filters even see mouse events for <a href="qwidget.html#enabled-prop">disabled widgets</a>.</li>
<li>Reimplementing <a href="qobject.html#event">QObject.event</a>() (as <a href="qwidget.html">QWidget</a> does). If you do this you get Tab key presses, and you get to see the events before any widget-specific event filters.</li>
<li>Installing an event filter on the object. Such an event filter gets all the events except Tab and Shift-Tab key presses.</li>
</ol>
<p>See also <a href="qobject.html#event">QObject.event</a>() and <a href="qobject.html#installEventFilter">installEventFilter</a>().</p>
<h3 class="fn"><a name="organizationDomain" /><a href="qstring.html">QString</a> QCoreApplication.organizationDomain ()</h3><h3 class="fn"><a name="organizationName" /><a href="qstring.html">QString</a> QCoreApplication.organizationName ()</h3><h3 class="fn"><a name="postEvent" />QCoreApplication.postEvent (<a href="qobject.html">QObject</a>&#160;<i>receiver</i>, <a href="qevent.html">QEvent</a>&#160;<i>event</i>)</h3><p>The <i>event</i> argument has it's ownership transferred to Qt.</p><p>Adds the event <i>event</i> with the object <i>receiver</i> as the receiver of the event, to an event queue and returns immediately.</p>
<p>The event must be allocated on the heap since the post event queue will take ownership of the event and delete it once it has been posted. It is <i>not safe</i> to modify or delete the event after it has been posted.</p>
<p>When control returns to the main event loop, all events that are stored in the queue will be sent using the <a href="qcoreapplication.html#notify">notify</a>() function.</p>
<p><b>Note:</b> This function is <a href="threads.html#thread-safe">thread-safe</a>.</p>
<p>See also <a href="qcoreapplication.html#sendEvent">sendEvent</a>(), <a href="qcoreapplication.html#notify">notify</a>(), and sendPostedEvent().</p>
<h3 class="fn"><a name="processEvents" />QCoreApplication.processEvents (<a href="qeventloop-processeventsflags.html">QEventLoop.ProcessEventsFlags</a>&#160;<i>flags</i>&#160;=&#160;QEventLoop.AllEvents)</h3><p>Processes all pending events according to the specified <i>flags</i> until there are no more events to process.</p>
<p>You can call this function occasionally when your program is busy performing a long operation (e.g. copying a file).</p>
<p>See also <a href="qcoreapplication.html#exec">exec_</a>(), <a href="qtimer.html">QTimer</a>, <a href="qeventloop.html#processEvents">QEventLoop.processEvents</a>(), <a href="qcoreapplication.html#flush">flush</a>(), and <a href="qcoreapplication.html#sendPostedEvents">sendPostedEvents</a>().</p>
<h3 class="fn"><a name="processEvents-2" />QCoreApplication.processEvents (<a href="qeventloop-processeventsflags.html">QEventLoop.ProcessEventsFlags</a>&#160;<i>flags</i>, int&#160;<i>maxtime</i>)</h3><p>This is an overloaded member function, provided for convenience.</p>
<p>Processes pending events for <i>maxtime</i> milliseconds or until there are no more events to process, whichever is shorter.</p>
<p>You can call this function occasionally when you program is busy doing a long operation (e.g. copying a file).</p>
<p>See also <a href="qcoreapplication.html#exec">exec_</a>(), <a href="qtimer.html">QTimer</a>, and <a href="qeventloop.html#processEvents">QEventLoop.processEvents</a>().</p>
<h3 class="fn"><a name="quit" />QCoreApplication.quit ()</h3><p>This method is also a Qt slot with the C++ signature <tt>void quit()</tt>.</p><p>Tells the application to exit with return code 0 (success). Equivalent to calling QCoreApplication.exit(0).</p>
<p>It's common to connect the <a href="qapplication.html#lastWindowClosed">QApplication.lastWindowClosed</a>() signal to quit(), and you also often connect e.g. <a href="qabstractbutton.html#clicked">QAbstractButton.clicked</a>() or signals in <a href="qaction.html">QAction</a>, <a href="qmenu.html">QMenu</a>, or <a href="qmenubar.html">QMenuBar</a> to it.</p>
<p>Example:</p>
<pre>
    QPushButton *quitButton = new QPushButton("Quit");
    connect(quitButton, SIGNAL(clicked()), &amp;app, SLOT(quit()));
</pre>
<p>See also <a href="qcoreapplication.html#exit">exit</a>(), <a href="qcoreapplication.html#aboutToQuit">aboutToQuit</a>(), and <a href="qapplication.html#lastWindowClosed">QApplication.lastWindowClosed</a>().</p>
<h3 class="fn"><a name="removeLibraryPath" />QCoreApplication.removeLibraryPath (<a href="qstring.html">QString</a>)</h3><p>Removes <i>path</i> from the library path list. If <i>path</i> is empty or not in the path list, the list is not changed.</p>
<p>See also <a href="qcoreapplication.html#addLibraryPath">addLibraryPath</a>(), <a href="qcoreapplication.html#libraryPaths">libraryPaths</a>(), and <a href="qcoreapplication.html#setLibraryPaths">setLibraryPaths</a>().</p>
<h3 class="fn"><a name="removePostedEvents" />QCoreApplication.removePostedEvents (<a href="qobject.html">QObject</a>&#160;<i>receiver</i>)</h3><p>Removes all events posted using <a href="qcoreapplication.html#postEvent">postEvent</a>() for <i>receiver</i>.</p>
<p>The events are <i>not</i> dispatched, instead they are removed from the queue. You should never need to call this function. If you do call it, be aware that killing events may cause <i>receiver</i> to break one or more invariants.</p>
<p><b>Note:</b> This function is <a href="threads.html#thread-safe">thread-safe</a>.</p>
<h3 class="fn"><a name="removeTranslator" />QCoreApplication.removeTranslator (<a href="qtranslator.html">QTranslator</a>)</h3><p>Removes the message file <i>messageFile</i> from the list of message files used by this application. (It does not delete the message file from the file system.)</p>
<p>See also <a href="qcoreapplication.html#installTranslator">installTranslator</a>(), <a href="qcoreapplication.html#translate">translate</a>(), and <a href="qobject.html#tr">QObject.tr</a>().</p>
<h3 class="fn"><a name="sendEvent" />bool QCoreApplication.sendEvent (<a href="qobject.html">QObject</a>&#160;<i>receiver</i>, <a href="qevent.html">QEvent</a>&#160;<i>event</i>)</h3><p>Sends event <i>event</i> directly to receiver <i>receiver</i>, using the <a href="qcoreapplication.html#notify">notify</a>() function. Returns the value that was returned from the event handler.</p>
<p>The event is <i>not</i> deleted when the event has been sent. The normal approach is to create the event on the stack, for example:</p>
<pre>
    QMouseEvent event(QEvent.MouseButtonPress, pos, 0, 0);
    QApplication.sendEvent(mainWindow, &amp;event);
</pre>
<p>See also <a href="qcoreapplication.html#postEvent">postEvent</a>() and <a href="qcoreapplication.html#notify">notify</a>().</p>
<h3 class="fn"><a name="sendPostedEvents" />QCoreApplication.sendPostedEvents (<a href="qobject.html">QObject</a>&#160;<i>receiver</i>, int&#160;<i>event_type</i>)</h3><p>Immediately dispatches all events which have been previously queued with <a href="qcoreapplication.html#postEvent">QCoreApplication.postEvent</a>() and which are for the object <i>receiver</i> and have the event type <i>event_type</i>.</p>
<p>Note that events from the window system are <i>not</i> dispatched by this function, but by <a href="qcoreapplication.html#processEvents">processEvents</a>().</p>
<p>If <i>receiver</i> is null, the events of <i>event_type</i> are sent for all objects. If <i>event_type</i> is 0, all the events are sent for <i>receiver</i>.</p>
<p>See also <a href="qcoreapplication.html#flush">flush</a>() and <a href="qcoreapplication.html#postEvent">postEvent</a>().</p>
<h3 class="fn"><a name="sendPostedEvents-2" />QCoreApplication.sendPostedEvents ()</h3><p>This is an overloaded member function, provided for convenience.</p>
<p>Dispatches all posted events, i.e. empties the event queue.</p>
<h3 class="fn"><a name="setApplicationName" />QCoreApplication.setApplicationName (<a href="qstring.html">QString</a>&#160;<i>application</i>)</h3><h3 class="fn"><a name="setLibraryPaths" />QCoreApplication.setLibraryPaths (<a href="qstringlist.html">QStringList</a>)</h3><p>Sets the list of directories to search when loading libraries to <i>paths</i>. All existing paths will be deleted and the path list will consist of the paths given in <i>paths</i>.</p>
<p>See also <a href="qcoreapplication.html#libraryPaths">libraryPaths</a>(), <a href="qcoreapplication.html#addLibraryPath">addLibraryPath</a>(), <a href="qcoreapplication.html#removeLibraryPath">removeLibraryPath</a>(), and <a href="qlibrary.html">QLibrary</a>.</p>
<h3 class="fn"><a name="setOrganizationDomain" />QCoreApplication.setOrganizationDomain (<a href="qstring.html">QString</a>&#160;<i>orgDomain</i>)</h3><h3 class="fn"><a name="setOrganizationName" />QCoreApplication.setOrganizationName (<a href="qstring.html">QString</a>&#160;<i>orgName</i>)</h3><h3 class="fn"><a name="startingUp" />bool QCoreApplication.startingUp ()</h3><p>Returns true if an application object has not been created yet; otherwise returns false.</p>
<p>See also <a href="qcoreapplication.html#closingDown">closingDown</a>().</p>
<h3 class="fn"><a name="translate" /><a href="qstring.html">QString</a> QCoreApplication.translate (str&#160;<i>context</i>, str&#160;<i>key</i>, str&#160;<i>comment</i>&#160;=&#160;None, <a href="qcoreapplication.html#Encoding-enum">Encoding</a>&#160;<i>encoding</i>&#160;=&#160;QCoreApplication.DefaultCodec)</h3><p>Returns the translation text for <i>sourceText</i>, by querying the installed messages files. The message files are searched from the most recently installed message file back to the first installed message file.</p>
<p><a href="qobject.html#tr">QObject.tr</a>() and <a href="qobject.html#trUtf8">QObject.trUtf8</a>() provide this functionality more conveniently.</p>
<p><i>context</i> is typically a class name (e.g., "MyDialog") and <i>sourceText</i> is either English text or a short identifying text, if the output text will be very long (as for help texts).</p>
<p><i>comment</i> is a disambiguating comment, for when the same <i>sourceText</i> is used in different roles within the same context. By default, it is null. <i>encoding</i> indicates the 8-bit encoding of character stings</p>
<p>See the <a href="qtranslator.html">QTranslator</a> documentation for more information about contexts and comments.</p>
<p>If none of the message files contain a translation for <i>sourceText</i> in <i>context</i>, this function returns a <a href="qstring.html">QString</a> equivalent of <i>sourceText</i>. The encoding of <i>sourceText</i> is specified by <i>encoding</i>; it defaults to <tt>DefaultCodec</tt>.</p>
<p>This function is not virtual. You can use alternative translation techniques by subclassing <a href="qtranslator.html">QTranslator</a>.</p>
<p><b>Warning:</b> This method is reentrant only if all translators are installed <i>before</i> calling this method. Installing or removing translators while performing translations is not supported. Doing so will most likely result in crashes or other undesirable behavior.</p>
<p><b>Note:</b> This function is <a href="threads.html#reentrant">reentrant</a>.</p>
<p>See also <a href="qobject.html#tr">QObject.tr</a>(), <a href="qcoreapplication.html#installTranslator">installTranslator</a>(), and <a href="qtextcodec.html#codecForTr">QTextCodec.codecForTr</a>().</p>
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="aboutToQuit" />void aboutToQuit ()</h3><p>This signal is emitted when the application is about to quit the main event loop, e.g. when the event loop level drops to zero. This may happen either after a call to <a href="qcoreapplication.html#quit">quit</a>() from inside the application or when the users shuts down the entire desktop session.</p>
<p>The signal is particularly useful if your application has to do some last-second cleanup. Note that no user interaction is possible in this state.</p>
<p>See also <a href="qcoreapplication.html#quit">quit</a>().</p>
<h3 class="fn"><a name="unixSignal" />void unixSignal (int)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt&#160;4.0.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.trolltech.com">Trolltech&#160;AS</a> 2006</td><td align="right" width="25%">Qt&#160;4.1.4</td></tr></table></div></address></body></html>