Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 1dd17e0d683ef79b4bb6872bbf359d7f > files > 4997

qt4-doc-4.8.7-26.2.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qcoreapplication.cpp -->
  <title>Qt 4.8: QCoreApplication Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtcore.html">QtCore</a></li>
<li>QCoreApplication</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#related-non-members">Related Non-Members</a></li>
<li class="level1"><a href="#macros">Macros</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#the-event-loop-and-event-handling">The Event Loop and Event Handling</a></li>
<li class="level2"><a href="#application-and-library-paths">Application and Library Paths</a></li>
<li class="level2"><a href="#internationalization-and-translations">Internationalization and Translations</a></li>
<li class="level2"><a href="#accessing-command-line-arguments">Accessing Command Line Arguments</a></li>
<li class="level2"><a href="#locale-settings">Locale Settings</a></li>
</ul>
</div>
<h1 class="title">QCoreApplication Class Reference</h1>
<!-- $$$QCoreApplication-brief -->
<p>The QCoreApplication class provides an event loop for console Qt applications. <a href="#details">More...</a></p>
<!-- @@@QCoreApplication -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QCoreApplication&gt;</span></pre><p><b>Inherits: </b><a href="qobject.html">QObject</a>.</p>
<p><b>Inherited by: </b><a href="qapplication.html">QApplication</a>.</p>
<ul>
<li><a href="qcoreapplication-members.html">List of all members, including inherited members</a></li>
<li><a href="qcoreapplication-qt3.html">Qt 3 support members</a></li>
</ul>
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#Encoding-enum">Encoding</a></b> { CodecForTr, UnicodeUTF8, DefaultCodec }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#EventFilter-typedef">EventFilter</a></b></td></tr>
</table>
<a name="properties"></a>
<h2>Properties</h2>
<ul>
<li class="fn"><b><a href="qcoreapplication.html#applicationName-prop">applicationName</a></b> : QString</li>
<li class="fn"><b><a href="qcoreapplication.html#applicationVersion-prop">applicationVersion</a></b> : QString</li>
<li class="fn"><b><a href="qcoreapplication.html#organizationDomain-prop">organizationDomain</a></b> : QString</li>
<li class="fn"><b><a href="qcoreapplication.html#organizationName-prop">organizationName</a></b> : QString</li>
</ul>
<ul>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#QCoreApplication">QCoreApplication</a></b> ( int &amp; <i>argc</i>, char ** <i>argv</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#dtor.QCoreApplication">~QCoreApplication</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#filterEvent">filterEvent</a></b> ( void * <i>message</i>, long * <i>result</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#notify">notify</a></b> ( QObject * <i>receiver</i>, QEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> EventFilter </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#setEventFilter">setEventFilter</a></b> ( EventFilter <i>filter</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#winEventFilter">winEventFilter</a></b> ( MSG * <i>msg</i>, long * <i>result</i> )</td></tr>
</table>
<ul>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<a name="public-slots"></a>
<h2>Public Slots</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#quit">quit</a></b> ()</td></tr>
</table>
<ul>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
</ul>
<a name="signals"></a>
<h2>Signals</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#aboutToQuit">aboutToQuit</a></b> ()</td></tr>
</table>
<ul>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<a name="static-public-members"></a>
<h2>Static Public Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#addLibraryPath">addLibraryPath</a></b> ( const QString &amp; <i>path</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#applicationDirPath">applicationDirPath</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#applicationFilePath">applicationFilePath</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#applicationName-prop">applicationName</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qint64 </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#applicationPid">applicationPid</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#applicationVersion-prop">applicationVersion</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#arguments">arguments</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#closingDown">closingDown</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#exec">exec</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#exit">exit</a></b> ( int <i>returnCode</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#flush">flush</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#hasPendingEvents">hasPendingEvents</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#installTranslator">installTranslator</a></b> ( QTranslator * <i>translationFile</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QCoreApplication * </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#instance">instance</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#libraryPaths">libraryPaths</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#organizationDomain-prop">organizationDomain</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#organizationName-prop">organizationName</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#postEvent">postEvent</a></b> ( QObject * <i>receiver</i>, QEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#postEvent-2">postEvent</a></b> ( QObject * <i>receiver</i>, QEvent * <i>event</i>, int <i>priority</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#processEvents">processEvents</a></b> ( QEventLoop::ProcessEventsFlags <i>flags</i> = QEventLoop::AllEvents )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#processEvents-2">processEvents</a></b> ( QEventLoop::ProcessEventsFlags <i>flags</i>, int <i>maxtime</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#removeLibraryPath">removeLibraryPath</a></b> ( const QString &amp; <i>path</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#removePostedEvents">removePostedEvents</a></b> ( QObject * <i>receiver</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#removePostedEvents-2">removePostedEvents</a></b> ( QObject * <i>receiver</i>, int <i>eventType</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#removeTranslator">removeTranslator</a></b> ( QTranslator * <i>translationFile</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#sendEvent">sendEvent</a></b> ( QObject * <i>receiver</i>, QEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#sendPostedEvents">sendPostedEvents</a></b> ( QObject * <i>receiver</i>, int <i>event_type</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#sendPostedEvents-2">sendPostedEvents</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#applicationName-prop">setApplicationName</a></b> ( const QString &amp; <i>application</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#applicationVersion-prop">setApplicationVersion</a></b> ( const QString &amp; <i>version</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#setAttribute">setAttribute</a></b> ( Qt::ApplicationAttribute <i>attribute</i>, bool <i>on</i> = true )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#setLibraryPaths">setLibraryPaths</a></b> ( const QStringList &amp; <i>paths</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#organizationDomain-prop">setOrganizationDomain</a></b> ( const QString &amp; <i>orgDomain</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#organizationName-prop">setOrganizationName</a></b> ( const QString &amp; <i>orgName</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#startingUp">startingUp</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#testAttribute">testAttribute</a></b> ( Qt::ApplicationAttribute <i>attribute</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#translate">translate</a></b> ( const char * <i>context</i>, const char * <i>sourceText</i>, const char * <i>disambiguation</i>, Encoding <i>encoding</i>, int <i>n</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#translate-2">translate</a></b> ( const char * <i>context</i>, const char * <i>sourceText</i>, const char * <i>disambiguation</i> = 0, Encoding <i>encoding</i> = CodecForTr )</td></tr>
</table>
<ul>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
</ul>
<a name="reimplemented-protected-functions"></a>
<h2>Reimplemented Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#event">event</a></b> ( QEvent * <i>e</i> )</td></tr>
</table>
<ul>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="related-non-members"></a>
<h2>Related Non-Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#qAddPostRoutine">qAddPostRoutine</a></b> ( QtCleanUpFunction <i>ptr</i> )</td></tr>
</table>
<a name="macros"></a>
<h2>Macros</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qcoreapplication.html#Q_DECLARE_TR_FUNCTIONS">Q_DECLARE_TR_FUNCTIONS</a></b> (  <i>context</i> )</td></tr>
</table>
<a name="details"></a>
<!-- $$$QCoreApplication-description -->
<div class="descr">
<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&#x2e;, 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"></a>
<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>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#exec">exec</a>() will not return until the event loop exits; e.g&#x2e;, 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"></a>
<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"></a>
<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"></a>
<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 href="qcoreapplication-qt3.html#argv" class="compat">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"></a>
<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,&quot;C&quot;)</tt> right after initializing <a href="qapplication.html">QApplication</a> or QCoreApplication to reset the locale that is used for number formatting to &quot;C&quot;-locale.</p>
</div>
<p><b>See also </b><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>
<!-- @@@QCoreApplication -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$Encoding$$$CodecForTr$$$UnicodeUTF8$$$DefaultCodec -->
<h3 class="fn"><a name="Encoding-enum"></a>enum QCoreApplication::<span class="name">Encoding</span></h3>
<p>This enum type defines the 8-bit encoding of character string arguments to <a href="qcoreapplication.html#translate">translate</a>():</p>
<table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><tt>QCoreApplication::CodecForTr</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">The encoding specified by <a href="qtextcodec.html#codecForTr">QTextCodec::codecForTr</a>() (Latin-1 if none has been set).</td></tr>
<tr><td class="topAlign"><tt>QCoreApplication::UnicodeUTF8</tt></td><td class="topAlign"><tt>1</tt></td><td class="topAlign">UTF-8.</td></tr>
<tr><td class="topAlign"><tt>QCoreApplication::DefaultCodec</tt></td><td class="topAlign"><tt>CodecForTr</tt></td><td class="topAlign">(Obsolete) Use CodecForTr instead.</td></tr>
</table>
<p><b>See also </b><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>
<!-- @@@Encoding -->
<!-- $$$EventFilter -->
<h3 class="fn"><a name="EventFilter-typedef"></a>typedef QCoreApplication::<span class="name">EventFilter</span></h3>
<p>A function with the following signature that can be used as an event filter:</p>
<pre class="cpp"> <span class="type">bool</span> myEventFilter(<span class="type">void</span> <span class="operator">*</span>message<span class="operator">,</span> <span class="type">long</span> <span class="operator">*</span>result);</pre>
<p><b>See also </b><a href="qcoreapplication.html#setEventFilter">setEventFilter</a>().</p>
<!-- @@@EventFilter -->
</div>
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$applicationName-prop$$$applicationName$$$setApplicationNameconstQString& -->
<h3 class="fn"><a name="applicationName-prop"></a><span class="name">applicationName</span> : <span class="type"><a href="qstring.html">QString</a></span></h3>
<p>This property holds the name of this application.</p>
<p>The value is used by the <a href="qsettings.html">QSettings</a> class when it is constructed using the empty constructor. This saves having to repeat this information each time a <a href="qsettings.html">QSettings</a> object is created.</p>
<p>On BlackBerry this property is read-only. It is obtained from the BAR application descriptor file.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QString </td><td class="memItemRight bottomAlign"><span class="name"><b>applicationName</b></span> ()</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setApplicationName</b></span> ( const QString &amp; <i>application</i> )</td></tr>
</table>
<p><b>See also </b><a href="qcoreapplication.html#organizationName-prop">organizationName</a>, <a href="qcoreapplication.html#organizationDomain-prop">organizationDomain</a>, and <a href="qcoreapplication.html#applicationVersion-prop">applicationVersion</a>.</p>
<!-- @@@applicationName -->
<!-- $$$applicationVersion-prop$$$applicationVersion$$$setApplicationVersionconstQString& -->
<h3 class="fn"><a name="applicationVersion-prop"></a><span class="name">applicationVersion</span> : <span class="type"><a href="qstring.html">QString</a></span></h3>
<p>This property holds the version of this application.</p>
<p>On BlackBerry this property is read-only. It is obtained from the BAR application descriptor file.</p>
<p>This property was introduced in Qt 4.4.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QString </td><td class="memItemRight bottomAlign"><span class="name"><b>applicationVersion</b></span> ()</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setApplicationVersion</b></span> ( const QString &amp; <i>version</i> )</td></tr>
</table>
<p><b>See also </b><a href="qcoreapplication.html#applicationName-prop">applicationName</a>, <a href="qcoreapplication.html#organizationName-prop">organizationName</a>, and <a href="qcoreapplication.html#organizationDomain-prop">organizationDomain</a>.</p>
<!-- @@@applicationVersion -->
<!-- $$$organizationDomain-prop$$$organizationDomain$$$setOrganizationDomainconstQString& -->
<h3 class="fn"><a name="organizationDomain-prop"></a><span class="name">organizationDomain</span> : <span class="type"><a href="qstring.html">QString</a></span></h3>
<p>This property holds the Internet domain of the organization that wrote this application.</p>
<p>The value is used by the <a href="qsettings.html">QSettings</a> class when it is constructed using the empty constructor. This saves having to repeat this information each time a <a href="qsettings.html">QSettings</a> object is created.</p>
<p>On Mac, <a href="qsettings.html">QSettings</a> uses organizationDomain() as the organization if it's not an empty string; otherwise it uses <a href="qcoreapplication.html#organizationName-prop">organizationName</a>(). On all other platforms, <a href="qsettings.html">QSettings</a> uses <a href="qcoreapplication.html#organizationName-prop">organizationName</a>() as the organization.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QString </td><td class="memItemRight bottomAlign"><span class="name"><b>organizationDomain</b></span> ()</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setOrganizationDomain</b></span> ( const QString &amp; <i>orgDomain</i> )</td></tr>
</table>
<p><b>See also </b><a href="qcoreapplication.html#organizationName-prop">organizationName</a>, <a href="qcoreapplication.html#applicationName-prop">applicationName</a>, and <a href="qcoreapplication.html#applicationVersion-prop">applicationVersion</a>.</p>
<!-- @@@organizationDomain -->
<!-- $$$organizationName-prop$$$organizationName$$$setOrganizationNameconstQString& -->
<h3 class="fn"><a name="organizationName-prop"></a><span class="name">organizationName</span> : <span class="type"><a href="qstring.html">QString</a></span></h3>
<p>This property holds the name of the organization that wrote this application.</p>
<p>The value is used by the <a href="qsettings.html">QSettings</a> class when it is constructed using the empty constructor. This saves having to repeat this information each time a <a href="qsettings.html">QSettings</a> object is created.</p>
<p>On Mac, <a href="qsettings.html">QSettings</a> uses <a href="qcoreapplication.html#organizationDomain-prop">organizationDomain</a>() as the organization if it's not an empty string; otherwise it uses organizationName(). On all other platforms, <a href="qsettings.html">QSettings</a> uses organizationName() as the organization.</p>
<p>On BlackBerry this property is read-only. It is obtained from the BAR application descriptor file.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QString </td><td class="memItemRight bottomAlign"><span class="name"><b>organizationName</b></span> ()</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setOrganizationName</b></span> ( const QString &amp; <i>orgName</i> )</td></tr>
</table>
<p><b>See also </b><a href="qcoreapplication.html#organizationDomain-prop">organizationDomain</a> and <a href="qcoreapplication.html#applicationName-prop">applicationName</a>.</p>
<!-- @@@organizationName -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QCoreApplication[overload1]$$$QCoreApplicationint&char** -->
<h3 class="fn"><a name="QCoreApplication"></a>QCoreApplication::<span class="name">QCoreApplication</span> ( <span class="type">int</span> &amp; <i>argc</i>, <span class="type">char</span> ** <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>
<!-- @@@QCoreApplication -->
<!-- $$$~QCoreApplication[overload1]$$$~QCoreApplication -->
<h3 class="fn"><a name="dtor.QCoreApplication"></a>QCoreApplication::<span class="name">~QCoreApplication</span> ()</h3>
<p>Destroys the <a href="qcoreapplication.html">QCoreApplication</a> object.</p>
<!-- @@@~QCoreApplication -->
<!-- $$$aboutToQuit[overload1]$$$aboutToQuit -->
<h3 class="fn"><a name="aboutToQuit"></a><span class="type">void</span> QCoreApplication::<span class="name">aboutToQuit</span> ()<tt> [signal]</tt></h3>
<p>This signal is emitted when the application is about to quit the main event loop, e.g&#x2e; 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><b>See also </b><a href="qcoreapplication.html#quit">quit</a>().</p>
<!-- @@@aboutToQuit -->
<!-- $$$addLibraryPath[overload1]$$$addLibraryPathconstQString& -->
<h3 class="fn"><a name="addLibraryPath"></a><span class="type">void</span> QCoreApplication::<span class="name">addLibraryPath</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>path</i> )<tt> [static]</tt></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><b>See also </b><a href="qcoreapplication.html#removeLibraryPath">removeLibraryPath</a>(), <a href="qcoreapplication.html#libraryPaths">libraryPaths</a>(), and <a href="qcoreapplication.html#setLibraryPaths">setLibraryPaths</a>().</p>
<!-- @@@addLibraryPath -->
<!-- $$$applicationDirPath[overload1]$$$applicationDirPath -->
<h3 class="fn"><a name="applicationDirPath"></a><span class="type"><a href="qstring.html">QString</a></span> QCoreApplication::<span class="name">applicationDirPath</span> ()<tt> [static]</tt></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 &quot;C:/Trolltech/Qt/examples/tools/regexp&quot;.</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&#x2e; ROM, then the private path on the system drive will be returned.</p>
<p><b>See also </b><a href="qcoreapplication.html#applicationFilePath">applicationFilePath</a>().</p>
<!-- @@@applicationDirPath -->
<!-- $$$applicationFilePath[overload1]$$$applicationFilePath -->
<h3 class="fn"><a name="applicationFilePath"></a><span class="type"><a href="qstring.html">QString</a></span> QCoreApplication::<span class="name">applicationFilePath</span> ()<tt> [static]</tt></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 &quot;/usr/local/qt/examples/tools/regexp/regexp&quot;.</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><b>See also </b><a href="qcoreapplication.html#applicationDirPath">applicationDirPath</a>().</p>
<!-- @@@applicationFilePath -->
<!-- $$$applicationPid[overload1]$$$applicationPid -->
<h3 class="fn"><a name="applicationPid"></a><span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> QCoreApplication::<span class="name">applicationPid</span> ()<tt> [static]</tt></h3>
<p>Returns the current process ID for the application.</p>
<p>This function was introduced in Qt 4.4.</p>
<!-- @@@applicationPid -->
<!-- $$$arguments[overload1]$$$arguments -->
<h3 class="fn"><a name="arguments"></a><span class="type"><a href="qstringlist.html">QStringList</a></span> QCoreApplication::<span class="name">arguments</span> ()<tt> [static]</tt></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>For Symbian applications started with <tt>RApaLsSession::StartApp</tt> one can specify arguments using <tt>CApaCommandLine::SetTailEndL</tt> function. Such arguments are only available via this method; they will not be passed to <tt>main</tt> function. Also note that only 8-bit string data set with <tt>CApaCommandLine::SetTailEndL</tt> is supported by this function.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also </b><a href="qcoreapplication.html#applicationFilePath">applicationFilePath</a>().</p>
<!-- @@@arguments -->
<!-- $$$closingDown[overload1]$$$closingDown -->
<h3 class="fn"><a name="closingDown"></a><span class="type">bool</span> QCoreApplication::<span class="name">closingDown</span> ()<tt> [static]</tt></h3>
<p>Returns true if the application objects are being destroyed; otherwise returns false.</p>
<p><b>See also </b><a href="qcoreapplication.html#startingUp">startingUp</a>().</p>
<!-- @@@closingDown -->
<!-- $$$event[overload1]$$$eventQEvent* -->
<h3 class="fn"><a name="event"></a><span class="type">bool</span> QCoreApplication::<span class="name">event</span> ( <span class="type"><a href="qevent.html">QEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qobject.html#event">QObject::event</a>().</p>
<!-- @@@event -->
<!-- $$$exec[overload1]$$$exec -->
<h3 class="fn"><a name="exec"></a><span class="type">int</span> QCoreApplication::<span class="name">exec</span> ()<tt> [static]</tt></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&#x2e; 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><b>See also </b><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>
<!-- @@@exec -->
<!-- $$$exit[overload1]$$$exitint -->
<h3 class="fn"><a name="exit"></a><span class="type">void</span> QCoreApplication::<span class="name">exit</span> ( <span class="type">int</span> <i>returnCode</i> = 0 )<tt> [static]</tt></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><b>See also </b><a href="qcoreapplication.html#quit">quit</a>() and <a href="qcoreapplication.html#exec">exec</a>().</p>
<!-- @@@exit -->
<!-- $$$filterEvent[overload1]$$$filterEventvoid*long* -->
<h3 class="fn"><a name="filterEvent"></a><span class="type">bool</span> QCoreApplication::<span class="name">filterEvent</span> ( <span class="type">void</span> * <i>message</i>, <span class="type">long</span> * <i>result</i> )</h3>
<p>Sends <i>message</i> through the event filter that was set by <a href="qcoreapplication.html#setEventFilter">setEventFilter</a>(). If no event filter has been set, this function returns false; otherwise, this function returns the result of the event filter function in the <i>result</i> parameter.</p>
<p><b>See also </b><a href="qcoreapplication.html#setEventFilter">setEventFilter</a>().</p>
<!-- @@@filterEvent -->
<!-- $$$flush[overload1]$$$flush -->
<h3 class="fn"><a name="flush"></a><span class="type">void</span> QCoreApplication::<span class="name">flush</span> ()<tt> [static]</tt></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&#x2e; Splash Screens), call this function.</p>
<p><b>See also </b><a href="qcoreapplication.html#sendPostedEvents">sendPostedEvents</a>().</p>
<!-- @@@flush -->
<!-- $$$hasPendingEvents[overload1]$$$hasPendingEvents -->
<h3 class="fn"><a name="hasPendingEvents"></a><span class="type">bool</span> QCoreApplication::<span class="name">hasPendingEvents</span> ()<tt> [static]</tt></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><b>See also </b><a href="qabstracteventdispatcher.html#hasPendingEvents">QAbstractEventDispatcher::hasPendingEvents</a>().</p>
<!-- @@@hasPendingEvents -->
<!-- $$$installTranslator[overload1]$$$installTranslatorQTranslator* -->
<h3 class="fn"><a name="installTranslator"></a><span class="type">void</span> QCoreApplication::<span class="name">installTranslator</span> ( <span class="type"><a href="qtranslator.html">QTranslator</a></span> * <i>translationFile</i> )<tt> [static]</tt></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><b>See also </b><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>
<!-- @@@installTranslator -->
<!-- $$$instance[overload1]$$$instance -->
<h3 class="fn"><a name="instance"></a><span class="type">QCoreApplication</span> * QCoreApplication::<span class="name">instance</span> ()<tt> [static]</tt></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>
<!-- @@@instance -->
<!-- $$$libraryPaths[overload1]$$$libraryPaths -->
<h3 class="fn"><a name="libraryPaths"></a><span class="type"><a href="qstringlist.html">QStringList</a></span> QCoreApplication::<span class="name">libraryPaths</span> ()<tt> [static]</tt></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 class="cpp"> <a href="qtglobal.html#foreach">foreach</a> (<span class="keyword">const</span> <span class="type"><a href="qstring.html">QString</a></span> <span class="operator">&amp;</span>path<span class="operator">,</span> app<span class="operator">.</span>libraryPaths())
     do_something(path);</pre>
<p><b>See also </b><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>
<!-- @@@libraryPaths -->
<!-- $$$notify[overload1]$$$notifyQObject*QEvent* -->
<h3 class="fn"><a name="notify"></a><span class="type">bool</span> QCoreApplication::<span class="name">notify</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>receiver</i>, <span class="type"><a href="qevent.html">QEvent</a></span> * <i>event</i> )<tt> [virtual]</tt></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&#x2e; 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&#x2e;, 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 class="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><b>See also </b><a href="qobject.html#event">QObject::event</a>() and <a href="qobject.html#installEventFilter">installEventFilter</a>().</p>
<!-- @@@notify -->
<!-- $$$postEvent[overload1]$$$postEventQObject*QEvent* -->
<h3 class="fn"><a name="postEvent"></a><span class="type">void</span> QCoreApplication::<span class="name">postEvent</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>receiver</i>, <span class="type"><a href="qevent.html">QEvent</a></span> * <i>event</i> )<tt> [static]</tt></h3>
<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 access 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><b>See also </b><a href="qcoreapplication.html#sendEvent">sendEvent</a>(), <a href="qcoreapplication.html#notify">notify</a>(), and <a href="qcoreapplication.html#sendPostedEvents">sendPostedEvents</a>().</p>
<!-- @@@postEvent -->
<!-- $$$postEvent$$$postEventQObject*QEvent*int -->
<h3 class="fn"><a name="postEvent-2"></a><span class="type">void</span> QCoreApplication::<span class="name">postEvent</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>receiver</i>, <span class="type"><a href="qevent.html">QEvent</a></span> * <i>event</i>, <span class="type">int</span> <i>priority</i> )<tt> [static]</tt></h3>
<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 access 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&#x2e; 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&#x2e; 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><b>See also </b><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>
<!-- @@@postEvent -->
<!-- $$$processEvents[overload1]$$$processEventsQEventLoop::ProcessEventsFlags -->
<h3 class="fn"><a name="processEvents"></a><span class="type">void</span> QCoreApplication::<span class="name">processEvents</span> ( <span class="type"><a href="qeventloop.html#ProcessEventsFlag-enum">QEventLoop::ProcessEventsFlags</a></span> <i>flags</i> = QEventLoop::AllEvents )<tt> [static]</tt></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&#x2e; 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&#x2e; <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><b>See also </b><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>
<!-- @@@processEvents -->
<!-- $$$processEvents$$$processEventsQEventLoop::ProcessEventsFlagsint -->
<h3 class="fn"><a name="processEvents-2"></a><span class="type">void</span> QCoreApplication::<span class="name">processEvents</span> ( <span class="type"><a href="qeventloop.html#ProcessEventsFlag-enum">QEventLoop::ProcessEventsFlags</a></span> <i>flags</i>, <span class="type">int</span> <i>maxtime</i> )<tt> [static]</tt></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&#x2e; 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><b>See also </b><a href="qcoreapplication.html#exec">exec</a>(), <a href="qtimer.html">QTimer</a>, and <a href="qeventloop.html#processEvents">QEventLoop::processEvents</a>().</p>
<!-- @@@processEvents -->
<!-- $$$quit[overload1]$$$quit -->
<h3 class="fn"><a name="quit"></a><span class="type">void</span> QCoreApplication::<span class="name">quit</span> ()<tt> [static slot]</tt></h3>
<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&#x2e; <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 class="cpp"> <span class="type"><a href="qpushbutton.html">QPushButton</a></span> <span class="operator">*</span>quitButton <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qpushbutton.html">QPushButton</a></span>(<span class="string">&quot;Quit&quot;</span>);
 <a href="qobject.html#connect">connect</a>(quitButton<span class="operator">,</span> SIGNAL(clicked())<span class="operator">,</span> <span class="operator">&amp;</span>app<span class="operator">,</span> SLOT(quit()));</pre>
<p><b>See also </b><a href="qcoreapplication.html#exit">exit</a>(), <a href="qcoreapplication.html#aboutToQuit">aboutToQuit</a>(), and <a href="qapplication.html#lastWindowClosed">QApplication::lastWindowClosed</a>().</p>
<!-- @@@quit -->
<!-- $$$removeLibraryPath[overload1]$$$removeLibraryPathconstQString& -->
<h3 class="fn"><a name="removeLibraryPath"></a><span class="type">void</span> QCoreApplication::<span class="name">removeLibraryPath</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>path</i> )<tt> [static]</tt></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><b>See also </b><a href="qcoreapplication.html#addLibraryPath">addLibraryPath</a>(), <a href="qcoreapplication.html#libraryPaths">libraryPaths</a>(), and <a href="qcoreapplication.html#setLibraryPaths">setLibraryPaths</a>().</p>
<!-- @@@removeLibraryPath -->
<!-- $$$removePostedEvents[overload1]$$$removePostedEventsQObject* -->
<h3 class="fn"><a name="removePostedEvents"></a><span class="type">void</span> QCoreApplication::<span class="name">removePostedEvents</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>receiver</i> )<tt> [static]</tt></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>
<!-- @@@removePostedEvents -->
<!-- $$$removePostedEvents$$$removePostedEventsQObject*int -->
<h3 class="fn"><a name="removePostedEvents-2"></a><span class="type">void</span> QCoreApplication::<span class="name">removePostedEvents</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>receiver</i>, <span class="type">int</span> <i>eventType</i> )<tt> [static]</tt></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>
<!-- @@@removePostedEvents -->
<!-- $$$removeTranslator[overload1]$$$removeTranslatorQTranslator* -->
<h3 class="fn"><a name="removeTranslator"></a><span class="type">void</span> QCoreApplication::<span class="name">removeTranslator</span> ( <span class="type"><a href="qtranslator.html">QTranslator</a></span> * <i>translationFile</i> )<tt> [static]</tt></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><b>See also </b><a href="qcoreapplication.html#installTranslator">installTranslator</a>(), <a href="qcoreapplication.html#translate">translate</a>(), and <a href="qobject.html#tr">QObject::tr</a>().</p>
<!-- @@@removeTranslator -->
<!-- $$$sendEvent[overload1]$$$sendEventQObject*QEvent* -->
<h3 class="fn"><a name="sendEvent"></a><span class="type">bool</span> QCoreApplication::<span class="name">sendEvent</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>receiver</i>, <span class="type"><a href="qevent.html">QEvent</a></span> * <i>event</i> )<tt> [static]</tt></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 class="cpp"> <span class="type"><a href="qmouseevent.html">QMouseEvent</a></span> <a href="qcoreapplication.html#event">event</a>(<span class="type"><a href="qevent.html">QEvent</a></span><span class="operator">::</span>MouseButtonPress<span class="operator">,</span> pos<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span>);
 <span class="type"><a href="qapplication.html">QApplication</a></span><span class="operator">::</span>sendEvent(mainWindow<span class="operator">,</span> <span class="operator">&amp;</span>event);</pre>
<p><b>See also </b><a href="qcoreapplication.html#postEvent">postEvent</a>() and <a href="qcoreapplication.html#notify">notify</a>().</p>
<!-- @@@sendEvent -->
<!-- $$$sendPostedEvents[overload1]$$$sendPostedEventsQObject*int -->
<h3 class="fn"><a name="sendPostedEvents"></a><span class="type">void</span> QCoreApplication::<span class="name">sendPostedEvents</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>receiver</i>, <span class="type">int</span> <i>event_type</i> )<tt> [static]</tt></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><b>See also </b><a href="qcoreapplication.html#flush">flush</a>() and <a href="qcoreapplication.html#postEvent">postEvent</a>().</p>
<!-- @@@sendPostedEvents -->
<!-- $$$sendPostedEvents$$$sendPostedEvents -->
<h3 class="fn"><a name="sendPostedEvents-2"></a><span class="type">void</span> QCoreApplication::<span class="name">sendPostedEvents</span> ()<tt> [static]</tt></h3>
<p>This function overloads <a href="qcoreapplication.html#sendPostedEvents">sendPostedEvents</a>().</p>
<p>Dispatches all posted events, i.e&#x2e; empties the event queue.</p>
<!-- @@@sendPostedEvents -->
<!-- $$$setAttribute[overload1]$$$setAttributeQt::ApplicationAttributebool -->
<h3 class="fn"><a name="setAttribute"></a><span class="type">void</span> QCoreApplication::<span class="name">setAttribute</span> ( <span class="type"><a href="qt.html#ApplicationAttribute-enum">Qt::ApplicationAttribute</a></span> <i>attribute</i>, <span class="type">bool</span> <i>on</i> = true )<tt> [static]</tt></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><b>See also </b><a href="qcoreapplication.html#testAttribute">testAttribute</a>().</p>
<!-- @@@setAttribute -->
<!-- $$$setEventFilter[overload1]$$$setEventFilterEventFilter -->
<h3 class="fn"><a name="setEventFilter"></a><span class="type"><a href="qcoreapplication.html#EventFilter-typedef">EventFilter</a></span> QCoreApplication::<span class="name">setEventFilter</span> ( <span class="type"><a href="qcoreapplication.html#EventFilter-typedef">EventFilter</a></span> <i>filter</i> )</h3>
<p>Replaces the event filter function for the <a href="qcoreapplication.html">QCoreApplication</a> with <i>filter</i> and returns the pointer to the replaced event filter function. Only the current event filter function is called. If you want to use both filter functions, save the replaced <a href="qcoreapplication.html#EventFilter-typedef">EventFilter</a> in a place where yours can call it.</p>
<p>The event filter function set here is called for all messages received by all threads meant for all Qt objects. It is <i>not</i> called for messages that are not meant for Qt objects.</p>
<p>The event filter function should return true if the message should be filtered, (i.e&#x2e; stopped). It should return false to allow processing the message to continue.</p>
<p>By default, no event filter function is set (i.e&#x2e;, this function returns a null <a href="qcoreapplication.html#EventFilter-typedef">EventFilter</a> the first time it is called).</p>
<p><b>Note:</b> The filter function set here receives native messages, i.e&#x2e; MSG or XEvent structs, that are going to Qt objects. It is called by <a href="qcoreapplication.html#filterEvent">QCoreApplication::filterEvent</a>(). If the filter function returns false to indicate the message should be processed further, the native message can then be translated into a <a href="qevent.html">QEvent</a> and handled by the standard Qt <a href="qevent.html">event</a> filering, e.g&#x2e; <a href="qobject.html#installEventFilter">QObject::installEventFilter</a>().</p>
<p><b>Note:</b> The filter function set here is different form the filter function set via <a href="qabstracteventdispatcher.html#setEventFilter">QAbstractEventDispatcher::setEventFilter</a>(), which gets all messages received by its thread, even messages meant for objects that are not handled by Qt.</p>
<p><b>See also </b><a href="qobject.html#installEventFilter">QObject::installEventFilter</a>() and <a href="qabstracteventdispatcher.html#setEventFilter">QAbstractEventDispatcher::setEventFilter</a>().</p>
<!-- @@@setEventFilter -->
<!-- $$$setLibraryPaths[overload1]$$$setLibraryPathsconstQStringList& -->
<h3 class="fn"><a name="setLibraryPaths"></a><span class="type">void</span> QCoreApplication::<span class="name">setLibraryPaths</span> ( const <span class="type"><a href="qstringlist.html">QStringList</a></span> &amp; <i>paths</i> )<tt> [static]</tt></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><b>See also </b><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>
<!-- @@@setLibraryPaths -->
<!-- $$$startingUp[overload1]$$$startingUp -->
<h3 class="fn"><a name="startingUp"></a><span class="type">bool</span> QCoreApplication::<span class="name">startingUp</span> ()<tt> [static]</tt></h3>
<p>Returns true if an application object has not been created yet; otherwise returns false.</p>
<p><b>See also </b><a href="qcoreapplication.html#closingDown">closingDown</a>().</p>
<!-- @@@startingUp -->
<!-- $$$testAttribute[overload1]$$$testAttributeQt::ApplicationAttribute -->
<h3 class="fn"><a name="testAttribute"></a><span class="type">bool</span> QCoreApplication::<span class="name">testAttribute</span> ( <span class="type"><a href="qt.html#ApplicationAttribute-enum">Qt::ApplicationAttribute</a></span> <i>attribute</i> )<tt> [static]</tt></h3>
<p>Returns true if attribute <i>attribute</i> is set; otherwise returns false.</p>
<p><b>See also </b><a href="qcoreapplication.html#setAttribute">setAttribute</a>().</p>
<!-- @@@testAttribute -->
<!-- $$$translate[overload1]$$$translateconstchar*constchar*constchar*Encodingint -->
<h3 class="fn"><a name="translate"></a><span class="type"><a href="qstring.html">QString</a></span> QCoreApplication::<span class="name">translate</span> ( const <span class="type">char</span> * <i>context</i>, const <span class="type">char</span> * <i>sourceText</i>, const <span class="type">char</span> * <i>disambiguation</i>, <span class="type"><a href="qcoreapplication.html#Encoding-enum">Encoding</a></span> <i>encoding</i>, <span class="type">int</span> <i>n</i> )<tt> [static]</tt></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&#x2e;, &quot;MyDialog&quot;) 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><b>See also </b><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>
<!-- @@@translate -->
<!-- $$$translate$$$translateconstchar*constchar*constchar*Encoding -->
<h3 class="fn"><a name="translate-2"></a><span class="type"><a href="qstring.html">QString</a></span> QCoreApplication::<span class="name">translate</span> ( const <span class="type">char</span> * <i>context</i>, const <span class="type">char</span> * <i>sourceText</i>, const <span class="type">char</span> * <i>disambiguation</i> = 0, <span class="type"><a href="qcoreapplication.html#Encoding-enum">Encoding</a></span> <i>encoding</i> = CodecForTr )<tt> [static]</tt></h3>
<p>This function overloads <a href="qcoreapplication.html#translate">translate</a>().</p>
<!-- @@@translate -->
<!-- $$$winEventFilter[overload1]$$$winEventFilterMSG*long* -->
<h3 class="fn"><a name="winEventFilter"></a><span class="type">bool</span> QCoreApplication::<span class="name">winEventFilter</span> ( <span class="type">MSG</span> * <i>msg</i>, <span class="type">long</span> * <i>result</i> )<tt> [virtual]</tt></h3>
<p>The message procedure calls this function for every message received. Reimplement this function if you want to process window messages <i>msg</i> that are not processed by Qt. If you don't want the event to be processed by Qt, then return true and set <i>result</i> to the value that the window procedure should return. Otherwise return false.</p>
<p>It is only directly addressed messages that are filtered. To handle system wide messages, such as messages from a registered hot key, you need to install an event filter on the event dispatcher, which is returned from <a href="qabstracteventdispatcher.html#instance">QAbstractEventDispatcher::instance</a>().</p>
<!-- @@@winEventFilter -->
</div>
<div class="relnonmem">
<h2>Related Non-Members</h2>
<!-- $$$qAddPostRoutine[overload1]$$$qAddPostRoutineQtCleanUpFunction -->
<h3 class="fn"><a name="qAddPostRoutine"></a><span class="type">void</span> <span class="name">qAddPostRoutine</span> ( <span class="type">QtCleanUpFunction</span> <i>ptr</i> )</h3>
<p>Adds a global routine that will be called from the <a href="qapplication.html">QApplication</a> destructor. This function is normally used to add cleanup routines for program-wide functionality.</p>
<p>The function specified by <i>ptr</i> should take no arguments and should return nothing. For example:</p>
<pre class="cpp"> <span class="keyword">static</span> <span class="type">int</span> <span class="operator">*</span>global_ptr <span class="operator">=</span> <span class="number">0</span>;

 <span class="keyword">static</span> <span class="type">void</span> cleanup_ptr()
 {
     <span class="keyword">delete</span> <span class="operator">[</span><span class="operator">]</span> global_ptr;
     global_ptr <span class="operator">=</span> <span class="number">0</span>;
 }

 <span class="type">void</span> init_ptr()
 {
     global_ptr <span class="operator">=</span> <span class="keyword">new</span> <span class="type">int</span><span class="operator">[</span><span class="number">100</span><span class="operator">]</span>;      <span class="comment">// allocate data</span>
     qAddPostRoutine(cleanup_ptr);   <span class="comment">// delete later</span>
 }</pre>
<p>Note that for an application- or module-wide cleanup, qAddPostRoutine() is often not suitable. For example, if the program is split into dynamically loaded modules, the relevant module may be unloaded long before the <a href="qapplication.html">QApplication</a> destructor is called.</p>
<p>For modules and libraries, using a reference-counted initialization manager or Qt's parent-child deletion mechanism may be better. Here is an example of a private class that uses the parent-child mechanism to call a cleanup function at the right time:</p>
<pre class="cpp"> <span class="keyword">class</span> MyPrivateInitStuff : <span class="keyword">public</span> <span class="type"><a href="qobject.html">QObject</a></span>
 {
 <span class="keyword">public</span>:
     <span class="keyword">static</span> MyPrivateInitStuff <span class="operator">*</span>initStuff(<span class="type"><a href="qobject.html">QObject</a></span> <span class="operator">*</span>parent)
     {
         <span class="keyword">if</span> (<span class="operator">!</span>p)
             p <span class="operator">=</span> <span class="keyword">new</span> MyPrivateInitStuff(parent);
         <span class="keyword">return</span> p;
     }

     <span class="operator">~</span>MyPrivateInitStuff()
     {
         <span class="comment">// cleanup goes here</span>
     }

 <span class="keyword">private</span>:
     MyPrivateInitStuff(<span class="type"><a href="qobject.html">QObject</a></span> <span class="operator">*</span>parent)
         : <span class="type"><a href="qobject.html">QObject</a></span>(parent)
     {
         <span class="comment">// initialization goes here</span>
     }

     MyPrivateInitStuff <span class="operator">*</span>p;
 };</pre>
<p>By selecting the right parent object, this can often be made to clean up the module's data at the right moment.</p>
<!-- @@@qAddPostRoutine -->
</div>
<div class="macros">
<h2>Macro Documentation</h2>
<!-- $$$Q_DECLARE_TR_FUNCTIONS[overload1]$$$Q_DECLARE_TR_FUNCTIONS -->
<h3 class="fn"><a name="Q_DECLARE_TR_FUNCTIONS"></a><span class="name">Q_DECLARE_TR_FUNCTIONS</span> (  <i>context</i> )</h3>
<p>The Q_DECLARE_TR_FUNCTIONS() macro declares and implements two translation functions, <tt>tr()</tt> and <tt>trUtf8()</tt>, with these signatures:</p>
<pre class="cpp"> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="type"><a href="qstring.html">QString</a></span> tr(<span class="keyword">const</span> <span class="type">char</span> <span class="operator">*</span>sourceText<span class="operator">,</span>
                          <span class="keyword">const</span> <span class="type">char</span> <span class="operator">*</span>comment <span class="operator">=</span> <span class="number">0</span>);
 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="type"><a href="qstring.html">QString</a></span> trUtf8(<span class="keyword">const</span> <span class="type">char</span> <span class="operator">*</span>sourceText<span class="operator">,</span>
                              <span class="keyword">const</span> <span class="type">char</span> <span class="operator">*</span>comment <span class="operator">=</span> <span class="number">0</span>);</pre>
<p>This macro is useful if you want to use <a href="qobject.html#tr">QObject::tr</a>() or <a href="qobject.html#trUtf8">QObject::trUtf8</a>() in classes that don't inherit from <a href="qobject.html">QObject</a>.</p>
<p>Q_DECLARE_TR_FUNCTIONS() must appear at the very top of the class definition (before the first <tt>public:</tt> or <tt>protected:</tt>). For example:</p>
<pre class="cpp"> <span class="keyword">class</span> MyMfcView : <span class="keyword">public</span> CView
 {
     Q_DECLARE_TR_FUNCTIONS(MyMfcView)

 <span class="keyword">public</span>:
     MyMfcView();
     <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 };</pre>
<p>The <i>context</i> parameter is normally the class name, but it can be any string.</p>
<p><b>See also </b><a href="qobject.html#Q_OBJECT">Q_OBJECT</a>, <a href="qobject.html#tr">QObject::tr</a>(), and <a href="qobject.html#trUtf8">QObject::trUtf8</a>().</p>
<!-- @@@Q_DECLARE_TR_FUNCTIONS -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
      Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Qt and respective logos are trademarks of The Qt Company Ltd 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
  </div>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>