Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 3f684444755c5ad1181cdd5a97348f3c > files > 1055

PyQt4-devel-4.7.4-2.fc14.i686.rpm

<?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> { CodecForTr, UnicodeUTF8, DefaultCodec }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qcoreapplication.html#QCoreApplication">__init__</a></b> (<i>self</i>, list-of-str&#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#applicationPid">applicationPid</a></b> ()</li><li><div class="fn" />QString <b><a href="qcoreapplication.html#applicationVersion">applicationVersion</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-of-str <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>returnCode</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, QEvent)</li><li><div class="fn" /><b><a href="qcoreapplication.html#postEvent-2">postEvent</a></b> (QObject, QEvent, int)</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, int)</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)</li><li><div class="fn" /><b><a href="qcoreapplication.html#removePostedEvents-2">removePostedEvents</a></b> (QObject, int)</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, QEvent)</li><li><div class="fn" /><b><a href="qcoreapplication.html#sendPostedEvents">sendPostedEvents</a></b> (QObject, int)</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)</li><li><div class="fn" /><b><a href="qcoreapplication.html#setApplicationVersion">setApplicationVersion</a></b> (QString)</li><li><div class="fn" /><b><a href="qcoreapplication.html#setAttribute">setAttribute</a></b> (Qt.ApplicationAttribute, bool&#160;<i>on</i>&#160;=&#160;True)</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)</li><li><div class="fn" /><b><a href="qcoreapplication.html#setOrganizationName">setOrganizationName</a></b> (QString)</li><li><div class="fn" />bool <b><a href="qcoreapplication.html#startingUp">startingUp</a></b> ()</li><li><div class="fn" />bool <b><a href="qcoreapplication.html#testAttribute">testAttribute</a></b> (Qt.ApplicationAttribute)</li><li><div class="fn" />QString <b><a href="qcoreapplication.html#translate">translate</a></b> (str, str, str&#160;<i>disambiguation</i>&#160;=&#160;None, Encoding&#160;<i>encoding</i>&#160;=&#160;QCoreApplication.CodecForTr)</li><li><div class="fn" />QString <b><a href="qcoreapplication.html#translate-2">translate</a></b> (str, str, str, Encoding, int)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qcoreapplication.html#aboutToQuit">aboutToQuit</a></b> ()</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>
<a name="the-event-loop-and-event-handling" />
<h3>The Event Loop and Event Handling</h3>
<p>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, such as <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. <a href="qcoreapplication.html#exit">exit</a>() will not return until the event loop exits; e.g., when <a href="qcoreapplication.html#quit">quit</a>() is called.</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>().</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>
<a name="application-and-library-paths" />
<h3>Application and Library Paths</h3>
<p>An application has an <a href="qcoreapplication.html#applicationDirPath">applicationDirPath</a>() and an <a href="qcoreapplication.html#applicationFilePath">applicationFilePath</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>
<a name="internationalization-and-translations" />
<h3>Internationalization and Translations</h3>
<p>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>
<a name="accessing-command-line-arguments" />
<h3>Accessing Command Line Arguments</h3>
<p>The command line arguments which are passed to QCoreApplication's constructor should be accessed using the <a href="qcoreapplication.html#arguments">arguments</a>() function. Note that some arguments supplied by the user may have been processed and removed by QCoreApplication.</p>
<p>In cases where command line arguments need to be obtained using the <a class="compat" href="qcoreapplication-qt3.html#argv">argv</a>() function, you must convert them from the local string encoding using <a href="qstring.html#fromLocal8Bit">QString.fromLocal8Bit</a>().</p>
<a name="locale-settings" />
<h3>Locale Settings</h3>
<p>On Unix/Linux Qt is configured to use the system locale settings by default. This can cause a conflict when using POSIX functions, for instance, when converting between data types such as floats and strings, since the notation may differ between locales. To get around this problem, call the POSIX function <tt>setlocale(LC_NUMERIC,"C")</tt> right after initializing <a href="qapplication.html">QApplication</a> or QCoreApplication to reset the locale that is used for number formatting to "C"-locale.</p>
<p>See also <a href="qapplication.html">QApplication</a>, <a href="qabstracteventdispatcher.html">QAbstractEventDispatcher</a>, <a href="qeventloop.html">QEventLoop</a>, <a href="threads-semaphores.html">Semaphores Example</a>, and <a href="threads-waitconditions.html">Wait Conditions Example</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>
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" 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.CodecForTr</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>() (Latin-1 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>
<tr><td valign="top"><tt>QCoreApplication.DefaultCodec</tt></td><td align="center" valign="top"><tt>CodecForTr</tt></td><td valign="top">(Obsolete) Use CodecForTr instead.</td></tr>
</table></p>
<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>
<a name="//apple_ref/cpp/tdef/QCoreApplication/EventFilter" />
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QCoreApplication" />QCoreApplication.__init__ (<i>self</i>, list-of-str&#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>
<p><b>Warning:</b> The data referred to by <i>argc</i> and <i>argv</i> must stay valid for the entire lifetime of the <a href="qcoreapplication.html">QCoreApplication</a> object. In addition, <i>argc</i> must be greater than zero and <i>argv</i> must contain at least one valid character string.</p>
<a name="//apple_ref/cpp/instm/QCoreApplication/~QCoreApplication" />
<h3 class="fn"><a name="addLibraryPath" />QCoreApplication.addLibraryPath (QString)</h3><p>Prepends <i>path</i> to the beginning of the library path list, ensuring that it is searched for libraries first. 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>In Symbian this function is only useful for adding paths for finding Qt extension plugin stubs, since the OS can only load libraries from the <tt>/sys/bin</tt> directory.</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>
<a name="//apple_ref/cpp/clm/QCoreApplication/applicationDirPath" />
<h3 class="fn"><a name="applicationDirPath" />QString 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 Linux, this function will try to get the path from the <tt>/proc</tt> file system. If that fails, it assumes that <tt>argv[0]</tt> contains the absolute file name of the executable. The function also assumes that the current directory has not been changed by the application.</p>
<p>In Symbian this function will return the application private directory, not the path to executable itself, as those are always in <tt>/sys/bin</tt>. If the application is in a read only drive, i.e. ROM, then the private path on the system drive will be returned.</p>
<p>See also <a href="qcoreapplication.html#applicationFilePath">applicationFilePath</a>().</p>
<a name="//apple_ref/cpp/clm/QCoreApplication/applicationFilePath" />
<h3 class="fn"><a name="applicationFilePath" />QString 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 Linux, this function will try to get the path from the <tt>/proc</tt> file system. If that fails, it assumes that <tt>argv[0]</tt> contains the absolute file name of the executable. The function also assumes that the current directory has not been changed by the application.</p>
<p>See also <a href="qcoreapplication.html#applicationDirPath">applicationDirPath</a>().</p>
<a name="//apple_ref/cpp/clm/QCoreApplication/applicationPid" />
<h3 class="fn"><a name="applicationName" />QString QCoreApplication.applicationName ()</h3><h3 class="fn"><a name="applicationPid" />int QCoreApplication.applicationPid ()</h3><p>Returns the current process ID for the application.</p>
<p>This function was introduced in Qt 4.4.</p>
<a name="//apple_ref/cpp/clm/QCoreApplication/arguments" />
<h3 class="fn"><a name="applicationVersion" />QString QCoreApplication.applicationVersion ()</h3><h3 class="fn"><a name="argc" />int QCoreApplication.argc ()</h3><h3 class="fn"><a name="arguments" />QStringList QCoreApplication.arguments ()</h3><p>Returns the list of command-line arguments.</p>
<p>Usually arguments().at(0) is the program name, arguments().at(1) is the first argument, and arguments().last() is the last argument. See the note below about Windows.</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, for example, 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. On Windows, the arguments() are not built from the contents of argv/argc, as the content does not support Unicode. Instead, the arguments() are constructed from the return value of <a href="http://msdn2.microsoft.com/en-us/library/ms683156(VS.85).aspx">GetCommandLine()</a>. As a result of this, the string given by arguments().at(0) might not be the program name on Windows, depending on how the application was started.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qcoreapplication.html#applicationFilePath">applicationFilePath</a>().</p>
<a name="//apple_ref/cpp/clm/QCoreApplication/closingDown" />
<h3 class="fn"><a name="argv" />list-of-str 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>
<a name="//apple_ref/cpp/instm/QCoreApplication/event" />
<h3 class="fn"><a name="event" />bool QCoreApplication.event (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>
<a name="//apple_ref/cpp/clm/QCoreApplication/exec" />
<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>We recommend that you connect clean-up code to the <a href="qcoreapplication.html#aboutToQuit">aboutToQuit()</a> signal, instead of putting it in your application's <tt>main()</tt> function because on some platforms the QCoreApplication.exec() call may not return. For example, on Windows when the user logs off, the system terminates the process after Qt closes all top-level windows. Hence, there is no guarantee that the application will have time to exit its event loop and execute code at the end of the <tt>main()</tt> function after the QCoreApplication.exec() call.</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>
<a name="//apple_ref/cpp/clm/QCoreApplication/exit" />
<h3 class="fn"><a name="exit" />QCoreApplication.exit (int&#160;<i>returnCode</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>. If the event loop is not running, this function does nothing.</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>
<a name="//apple_ref/cpp/instm/QCoreApplication/filterEvent" />
<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>
<a name="//apple_ref/cpp/clm/QCoreApplication/hasPendingEvents" />
<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>
<a name="//apple_ref/cpp/clm/QCoreApplication/installTranslator" />
<h3 class="fn"><a name="installTranslator" />QCoreApplication.installTranslator (<a href="qtranslator.html">QTranslator</a>)</h3><p>Adds the translation file <i>translationFile</i> to the list of translation files to be used for translations.</p>
<p>Multiple translation files can be installed. Translations are searched for in the reverse order in which they were installed, so the most recently installed translation file is searched first and the first translation file installed is searched last. The search stops as soon as a translation containing a matching string is found.</p>
<p>Installing or removing a <a href="qtranslator.html">QTranslator</a>, or changing an installed <a href="qtranslator.html">QTranslator</a> generates a <a href="qevent.html#Type-enum">LanguageChange</a> event for the <a href="qcoreapplication.html">QCoreApplication</a> instance. A <a href="qapplication.html">QApplication</a> instance will propagate the event to all toplevel windows, where a reimplementation of changeEvent can re-translate the user interface by passing user-visible strings via the <a href="qobject.html#tr">tr</a>() function to the respective property setters. User-interface classes generated by <a href="designer-manual.html#qt-designer">Qt Designer</a> provide a <tt>retranslateUi()</tt> function that can be called.</p>
<p>See also <a href="qcoreapplication.html#removeTranslator">removeTranslator</a>(), <a href="qcoreapplication.html#translate">translate</a>(), <a href="qtranslator.html#load">QTranslator.load</a>(), and <a href="internationalization.html#dynamic-translation">Dynamic Translation</a>.</p>
<a name="//apple_ref/cpp/clm/QCoreApplication/instance" />
<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>
<p>If no instance has been allocated, <tt>null</tt> is returned.</p>
<a name="//apple_ref/cpp/clm/QCoreApplication/libraryPaths" />
<h3 class="fn"><a name="libraryPaths" />QStringList QCoreApplication.libraryPaths ()</h3><p>Returns a list of paths that the application will search when dynamically loading libraries.</p>
<p>Qt provides default library paths, but they can also be set using a <a href="qt-conf.html">qt.conf</a> file. Paths specified in this file will override default values.</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>
<a name="//apple_ref/cpp/instm/QCoreApplication/notify" />
<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. Note that this function is called for all events sent to any object in any thread.</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>. Note that application event filters are only called for objects that live in the main thread.</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, including Tab and Shift+Tab key press events, as long as they do not change the focus widget.</li>
</ol>
<p>See also <a href="qobject.html#event">QObject.event</a>() and <a href="qobject.html#installEventFilter">installEventFilter</a>().</p>
<a name="//apple_ref/cpp/clm/QCoreApplication/postEvent" />
<h3 class="fn"><a name="organizationDomain" />QString QCoreApplication.organizationDomain ()</h3><h3 class="fn"><a name="organizationName" />QString QCoreApplication.organizationName ()</h3><h3 class="fn"><a name="postEvent" />QCoreApplication.postEvent (<a href="qobject.html">QObject</a>, <a href="qevent.html">QEvent</a>)</h3><p>The <i>QEvent</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>Events are processed in the order posted. For more control over the processing order, use the postEvent() overload below, which takes a priority argument. This function posts all event with a <a href="qt.html#EventPriority-enum">Qt.NormalEventPriority</a>.</p>
<p><b>Note:</b> This function is <a href="threads-reentrancy.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 <a href="qcoreapplication.html#sendPostedEvents">sendPostedEvents</a>().</p>
<h3 class="fn"><a name="postEvent-2" />QCoreApplication.postEvent (<a href="qobject.html">QObject</a>, <a href="qevent.html">QEvent</a>, int)</h3><p>The <i>QEvent</i> argument has it's ownership transferred to Qt.</p><p>This function overloads <a href="qcoreapplication.html#postEvent">postEvent</a>().</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>Events are sorted in descending <i>priority</i> order, i.e. events with a high <i>priority</i> are queued before events with a lower <i>priority</i>. The <i>priority</i> can be any integer value, i.e. between INT_MAX and INT_MIN, inclusive; see <a href="qt.html#EventPriority-enum">Qt.EventPriority</a> for more details. Events with equal <i>priority</i> will be processed in the order posted.</p>
<p><b>Note:</b> This function is <a href="threads-reentrancy.html#thread-safe">thread-safe</a>.</p>
<p>This function was introduced in Qt 4.3.</p>
<p>See also <a href="qcoreapplication.html#sendEvent">sendEvent</a>(), <a href="qcoreapplication.html#notify">notify</a>(), <a href="qcoreapplication.html#sendPostedEvents">sendPostedEvents</a>(), and <a href="qt.html#EventPriority-enum">Qt.EventPriority</a>.</p>
<a name="//apple_ref/cpp/clm/QCoreApplication/processEvents" />
<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 for the calling thread 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>In event you are running a local loop which calls this function continuously, without an event loop, the <a href="qevent.html#Type-enum">DeferredDelete</a> events will not be processed. This can affect the behaviour of widgets, e.g. <a href="qtooltip.html">QToolTip</a>, that rely on <a href="qevent.html#Type-enum">DeferredDelete</a> events to function properly. An alternative would be to call <a href="qcoreapplication.html#sendPostedEvents">sendPostedEvents()</a> from within that local loop.</p>
<p>Calling this function processes events only for the calling thread.</p>
<p><b>Note:</b> This function is <a href="threads-reentrancy.html#thread-safe">thread-safe</a>.</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>, int)</h3><p>This function overloads <a href="qcoreapplication.html#processEvents">processEvents</a>().</p>
<p>Processes pending events for the calling thread 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>Calling this function processes events only for the calling thread.</p>
<p><b>Note:</b> This function is <a href="threads-reentrancy.html#thread-safe">thread-safe</a>.</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>
<a name="//apple_ref/cpp/clm/QCoreApplication/quit" />
<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>
<a name="//apple_ref/cpp/clm/QCoreApplication/removeLibraryPath" />
<h3 class="fn"><a name="removeLibraryPath" />QCoreApplication.removeLibraryPath (QString)</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>
<a name="//apple_ref/cpp/clm/QCoreApplication/removePostedEvents" />
<h3 class="fn"><a name="removePostedEvents" />QCoreApplication.removePostedEvents (<a href="qobject.html">QObject</a>)</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-reentrancy.html#thread-safe">thread-safe</a>.</p>
<h3 class="fn"><a name="removePostedEvents-2" />QCoreApplication.removePostedEvents (<a href="qobject.html">QObject</a>, int)</h3><p>This function overloads <a href="qcoreapplication.html#removePostedEvents">removePostedEvents</a>().</p>
<p>Removes all events of the given <i>eventType</i> that were 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>If <i>receiver</i> is null, the events of <i>eventType</i> are removed for all objects. If <i>eventType</i> is 0, all the events are removed for <i>receiver</i>.</p>
<p><b>Note:</b> This function is <a href="threads-reentrancy.html#thread-safe">thread-safe</a>.</p>
<p>This function was introduced in Qt 4.3.</p>
<a name="//apple_ref/cpp/clm/QCoreApplication/removeTranslator" />
<h3 class="fn"><a name="removeTranslator" />QCoreApplication.removeTranslator (<a href="qtranslator.html">QTranslator</a>)</h3><p>Removes the translation file <i>translationFile</i> from the list of translation files used by this application. (It does not delete the translation 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>
<a name="//apple_ref/cpp/clm/QCoreApplication/sendEvent" />
<h3 class="fn"><a name="sendEvent" />bool QCoreApplication.sendEvent (<a href="qobject.html">QObject</a>, <a href="qevent.html">QEvent</a>)</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, 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>
<a name="//apple_ref/cpp/clm/QCoreApplication/sendPostedEvents" />
<h3 class="fn"><a name="sendPostedEvents" />QCoreApplication.sendPostedEvents (<a href="qobject.html">QObject</a>, int)</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>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><b>Note:</b> This method must be called from the same thread as its <a href="qobject.html">QObject</a> parameter, <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 function overloads <a href="qcoreapplication.html#sendPostedEvents">sendPostedEvents</a>().</p>
<p>Dispatches all posted events, i.e. empties the event queue.</p>
<a name="//apple_ref/cpp/clm/QCoreApplication/setAttribute" />
<h3 class="fn"><a name="setApplicationName" />QCoreApplication.setApplicationName (QString)</h3><h3 class="fn"><a name="setApplicationVersion" />QCoreApplication.setApplicationVersion (QString)</h3><h3 class="fn"><a name="setAttribute" />QCoreApplication.setAttribute (<a href="qt.html#ApplicationAttribute-enum">Qt.ApplicationAttribute</a>, bool&#160;<i>on</i>&#160;=&#160;True)</h3><p>Sets the attribute <i>attribute</i> if <i>on</i> is true; otherwise clears the attribute.</p>
<p>One of the attributes that can be set with this method is <a href="qt.html#ApplicationAttribute-enum">Qt.AA_ImmediateWidgetCreation</a>. It tells Qt to create toplevel windows immediately. Normally, resources for widgets are allocated on demand to improve efficiency and minimize resource usage. Therefore, if it is important to minimize resource consumption, do not set this attribute.</p>
<p>See also <a href="qcoreapplication.html#testAttribute">testAttribute</a>().</p>
<a name="//apple_ref/cpp/instm/QCoreApplication/setEventFilter" />
<h3 class="fn"><a name="setLibraryPaths" />QCoreApplication.setLibraryPaths (QStringList)</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>In Symbian this function is only useful for setting paths for finding Qt extension plugin stubs, since the OS can only load libraries from the <tt>/sys/bin</tt> directory.</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>
<a name="//apple_ref/cpp/clm/QCoreApplication/startingUp" />
<h3 class="fn"><a name="setOrganizationDomain" />QCoreApplication.setOrganizationDomain (QString)</h3><h3 class="fn"><a name="setOrganizationName" />QCoreApplication.setOrganizationName (QString)</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>
<a name="//apple_ref/cpp/clm/QCoreApplication/testAttribute" />
<h3 class="fn"><a name="testAttribute" />bool QCoreApplication.testAttribute (<a href="qt.html#ApplicationAttribute-enum">Qt.ApplicationAttribute</a>)</h3><p>Returns true if attribute <i>attribute</i> is set; otherwise returns false.</p>
<p>See also <a href="qcoreapplication.html#setAttribute">setAttribute</a>().</p>
<a name="//apple_ref/cpp/clm/QCoreApplication/translate" />
<h3 class="fn"><a name="translate" />QString QCoreApplication.translate (str, str, str&#160;<i>disambiguation</i>&#160;=&#160;None, <a href="qcoreapplication.html#Encoding-enum">Encoding</a>&#160;<i>encoding</i>&#160;=&#160;QCoreApplication.CodecForTr)</h3><p>Returns the translation text for <i>sourceText</i>, by querying the installed translation files. The translation files are searched from the most recently installed file back to the first installed 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.</p>
<p><i>disambiguation</i> is an identifying string, for when the same <i>sourceText</i> is used in different roles within the same context. By default, it is null.</p>
<p>See the <a href="qtranslator.html">QTranslator</a> and <a href="qobject.html#tr">QObject.tr</a>() documentation for more information about contexts, disambiguations and comments.</p>
<p><i>encoding</i> indicates the 8-bit encoding of character strings.</p>
<p><i>n</i> is used in conjunction with <tt>%n</tt> to support plural forms. See <a href="qobject.html#tr">QObject.tr</a>() for details.</p>
<p>If none of the translation 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 <a href="qcoreapplication.html#Encoding-enum">CodecForTr</a>.</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-reentrancy.html#reentrant">reentrant</a>.</p>
<p>This function was introduced in Qt 4.5.</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>
<h3 class="fn"><a name="translate-2" />QString QCoreApplication.translate (str, str, str, <a href="qcoreapplication.html#Encoding-enum">Encoding</a>, int)</h3><p>This function overloads <a href="qcoreapplication.html#translate">translate</a>().</p>
<a name="//apple_ref/cpp/instm/QCoreApplication/winEventFilter" />
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="aboutToQuit" />void aboutToQuit ()</h3><p>This is the default overload of this signal.</p><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>
<a name="//apple_ref/cpp/clm/QCoreApplication/addLibraryPath" />
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.7.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> 2010</td><td align="right" width="25%">Qt&#160;4.6.3</td></tr></table></div></address></body></html>