Sophie

Sophie

distrib > Mageia > 6 > armv5tl > media > core-updates > by-pkgid > 768f7d9f703884aa2562bf0a651086df > files > 3228

qtbase5-doc-5.9.4-1.1.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qapplication.cpp -->
  <title>QApplication Class | Qt Widgets 5.9</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.9</td><td ><a href="qtwidgets-index.html">Qt Widgets</a></td><td ><a href="qtwidgets-module.html">C++ Classes</a></td><td >QApplication</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<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="#macros">Macros</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QApplication Class</h1>
<!-- $$$QApplication-brief -->
<p>The <a href="qapplication.html">QApplication</a> class manages the GUI application's control flow and main settings. <a href="#details">More...</a></p>
<!-- @@@QApplication -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QApplication&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += widgets</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="../qtgui/qguiapplication.html">QGuiApplication</a></td></tr></table></div><ul>
<li><a href="qapplication-members.html">List of all members, including inherited members</a></li>
<li><a href="qapplication-obsolete.html">Obsolete members</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<div class="table"><table class="propsummary">
<tr><td class="topAlign"><ul>
<li class="fn"><b><a href="qapplication.html#autoSipEnabled-prop">autoSipEnabled</a></b> : bool</li>
<li class="fn"><b><a href="qapplication.html#cursorFlashTime-prop">cursorFlashTime</a></b> : int</li>
<li class="fn"><b><a href="qapplication.html#doubleClickInterval-prop">doubleClickInterval</a></b> : int</li>
<li class="fn"><b><a href="qapplication.html#globalStrut-prop">globalStrut</a></b> : QSize</li>
<li class="fn"><b><a href="qapplication.html#keyboardInputInterval-prop">keyboardInputInterval</a></b> : int</li>
</ul></td><td class="topAlign"><ul>
<li class="fn"><b><a href="qapplication.html#startDragDistance-prop">startDragDistance</a></b> : int</li>
<li class="fn"><b><a href="qapplication.html#startDragTime-prop">startDragTime</a></b> : int</li>
<li class="fn"><b><a href="qapplication.html#styleSheet-prop">styleSheet</a></b> : QString</li>
<li class="fn"><b><a href="qapplication.html#wheelScrollLines-prop">wheelScrollLines</a></b> : int</li>
<li class="fn"><b><a href="qapplication.html#windowIcon-prop">windowIcon</a></b> : QIcon</li>
</ul>
</td></tr>
</table></div>
<ul>
<li class="fn">7 properties inherited from <a href="../qtgui/qguiapplication.html#properties">QGuiApplication</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#QApplication">QApplication</a></b>(int &amp;<i>argc</i>, char **<i>argv</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#dtor.QApplication">~QApplication</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#notify">notify</a></b>(QObject *<i>receiver</i>, QEvent *<i>e</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#styleSheet-prop">styleSheet</a></b>() const</td></tr>
</table></div>
<ul>
<li class="fn">6 public functions inherited from <a href="../qtgui/qguiapplication.html#public-functions">QGuiApplication</a></li>
</ul>
<a name="public-slots"></a>
<h2 id="public-slots">Public Slots</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#aboutQt">aboutQt</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#autoSipEnabled-prop">autoSipEnabled</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#closeAllWindows">closeAllWindows</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#autoSipEnabled-prop">setAutoSipEnabled</a></b>(const bool <i>enabled</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#styleSheet-prop">setStyleSheet</a></b>(const QString &amp;<i>sheet</i>)</td></tr>
</table></div>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#focusChanged">focusChanged</a></b>(QWidget *<i>old</i>, QWidget *<i>now</i>)</td></tr>
</table></div>
<ul>
<li class="fn">13 signals inherited from <a href="../qtgui/qguiapplication.html#signals">QGuiApplication</a></li>
</ul>
<a name="static-public-members"></a>
<h2 id="static-public-members">Static Public Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QWidget *</td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#activeModalWidget">activeModalWidget</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWidget *</td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#activePopupWidget">activePopupWidget</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWidget *</td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#activeWindow">activeWindow</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#alert">alert</a></b>(QWidget *<i>widget</i>, int <i>msec</i> = 0)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWidgetList </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#allWidgets">allWidgets</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#beep">beep</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#cursorFlashTime-prop">cursorFlashTime</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDesktopWidget *</td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#desktop">desktop</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#doubleClickInterval-prop">doubleClickInterval</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#exec">exec</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWidget *</td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#focusWidget">focusWidget</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QFont </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#font">font</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QFont </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#font-1">font</a></b>(const QWidget *<i>widget</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QFont </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#font-2">font</a></b>(const char *<i>className</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QFontMetrics </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#fontMetrics">fontMetrics</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSize </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#globalStrut-prop">globalStrut</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#isEffectEnabled">isEffectEnabled</a></b>(Qt::UIEffect <i>effect</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#keyboardInputInterval-prop">keyboardInputInterval</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::NavigationMode </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#navigationMode">navigationMode</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPalette </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#palette">palette</a></b>(const QWidget *<i>widget</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPalette </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#palette-1">palette</a></b>(const char *<i>className</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#setActiveWindow">setActiveWindow</a></b>(QWidget *<i>active</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#cursorFlashTime-prop">setCursorFlashTime</a></b>(<i>int</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#doubleClickInterval-prop">setDoubleClickInterval</a></b>(<i>int</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#setEffectEnabled">setEffectEnabled</a></b>(Qt::UIEffect <i>effect</i>, bool <i>enable</i> = true)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#setFont">setFont</a></b>(const QFont &amp;<i>font</i>, const char *<i>className</i> = Q_NULLPTR)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#globalStrut-prop">setGlobalStrut</a></b>(<i>const QSize &amp;</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#keyboardInputInterval-prop">setKeyboardInputInterval</a></b>(<i>int</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#setNavigationMode">setNavigationMode</a></b>(Qt::NavigationMode <i>mode</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#setPalette">setPalette</a></b>(const QPalette &amp;<i>palette</i>, const char *<i>className</i> = Q_NULLPTR)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#startDragDistance-prop">setStartDragDistance</a></b>(int <i>l</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#startDragTime-prop">setStartDragTime</a></b>(int <i>ms</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#setStyle">setStyle</a></b>(QStyle *<i>style</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStyle *</td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#setStyle-1">setStyle</a></b>(const QString &amp;<i>style</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#wheelScrollLines-prop">setWheelScrollLines</a></b>(<i>int</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#windowIcon-prop">setWindowIcon</a></b>(const QIcon &amp;<i>icon</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#startDragDistance-prop">startDragDistance</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#startDragTime-prop">startDragTime</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStyle *</td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#style">style</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWidget *</td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#topLevelAt">topLevelAt</a></b>(const QPoint &amp;<i>point</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWidget *</td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#topLevelAt-1">topLevelAt</a></b>(int <i>x</i>, int <i>y</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWidgetList </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#topLevelWidgets">topLevelWidgets</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#wheelScrollLines-prop">wheelScrollLines</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWidget *</td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#widgetAt">widgetAt</a></b>(const QPoint &amp;<i>point</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWidget *</td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#widgetAt-1">widgetAt</a></b>(int <i>x</i>, int <i>y</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QIcon </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#windowIcon-prop">windowIcon</a></b>()</td></tr>
</table></div>
<ul>
<li class="fn">44 static public members inherited from <a href="../qtgui/qguiapplication.html#static-public-members">QGuiApplication</a></li>
</ul>
<a name="protected-functions"></a>
<h2 id="protected-functions">Protected Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#event">event</a></b>(QEvent *<i>e</i>)</td></tr>
</table></div>
<ul>
<li class="fn">1 protected function inherited from <a href="../qtgui/qguiapplication.html#protected-functions">QGuiApplication</a></li>
</ul>
<a name="macros"></a>
<h2 id="macros">Macros</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#qApp">qApp</a></b></td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QApplication-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qapplication.html">QApplication</a> class manages the GUI application's control flow and main settings.</p>
<p><a href="qapplication.html">QApplication</a> specializes <a href="../qtgui/qguiapplication.html">QGuiApplication</a> with some functionality needed for <a href="qwidget.html">QWidget</a>-based applications. It handles widget specific initialization, finalization.</p>
<p>For any GUI application using Qt, there is precisely <b>one</b> <a href="qapplication.html">QApplication</a> object, no matter whether the application has 0, 1, 2 or more windows at any given time. For non-<a href="qwidget.html">QWidget</a> based Qt applications, use <a href="../qtgui/qguiapplication.html">QGuiApplication</a> instead, as it does not depend on the <a href="qtwidgets-module.html">QtWidgets</a> library.</p>
<p>Some GUI applications provide a special batch mode ie. provide command line arguments for executing tasks without manual intervention. In such non-GUI mode, it is often sufficient to instantiate a plain <a href="../qtcore/qcoreapplication.html">QCoreApplication</a> to avoid unnecessarily initializing resources needed for a graphical user interface. The following example shows how to dynamically create an appropriate type of application instance:</p>
<pre class="cpp">

  <span class="type"><a href="../qtcore/qcoreapplication.html">QCoreApplication</a></span><span class="operator">*</span> createApplication(<span class="type">int</span> <span class="operator">&amp;</span>argc<span class="operator">,</span> <span class="type">char</span> <span class="operator">*</span>argv<span class="operator">[</span><span class="operator">]</span>)
  {
      <span class="keyword">for</span> (<span class="type">int</span> i <span class="operator">=</span> <span class="number">1</span>; i <span class="operator">&lt;</span> argc; <span class="operator">+</span><span class="operator">+</span>i)
          <span class="keyword">if</span> (<span class="operator">!</span>qstrcmp(argv<span class="operator">[</span>i<span class="operator">]</span><span class="operator">,</span> <span class="string">&quot;-no-gui&quot;</span>))
              <span class="keyword">return</span> <span class="keyword">new</span> <span class="type"><a href="../qtcore/qcoreapplication.html">QCoreApplication</a></span>(argc<span class="operator">,</span> argv);
      <span class="keyword">return</span> <span class="keyword">new</span> <span class="type"><a href="qapplication.html#QApplication">QApplication</a></span>(argc<span class="operator">,</span> argv);
  }

  <span class="type">int</span> main(<span class="type">int</span> argc<span class="operator">,</span> <span class="type">char</span><span class="operator">*</span> argv<span class="operator">[</span><span class="operator">]</span>)
  {
      <span class="type"><a href="../qtcore/qscopedpointer.html">QScopedPointer</a></span><span class="operator">&lt;</span><span class="type"><a href="../qtcore/qcoreapplication.html">QCoreApplication</a></span><span class="operator">&gt;</span> app(createApplication(argc<span class="operator">,</span> argv));

      <span class="keyword">if</span> (qobject_cast<span class="operator">&lt;</span><span class="type"><a href="qapplication.html#QApplication">QApplication</a></span> <span class="operator">*</span><span class="operator">&gt;</span>(app<span class="operator">.</span>data())) {
         <span class="comment">// start GUI version...</span>
      } <span class="keyword">else</span> {
         <span class="comment">// start non-GUI version...</span>
      }

      <span class="keyword">return</span> app<span class="operator">-</span><span class="operator">&gt;</span>exec();
  }

</pre>
<p>The <a href="qapplication.html">QApplication</a> object is accessible through the instance() function that returns a pointer equivalent to the global <a href="qapplication.html#qApp">qApp</a> pointer.</p>
<p><a href="qapplication.html">QApplication</a>'s main areas of responsibility are:</p>
<ul>
<li>It initializes the application with the user's desktop settings such as <a href="qapplication.html#palette">palette</a>(), <a href="qapplication.html#font">font</a>() and <a href="qapplication.html#doubleClickInterval-prop">doubleClickInterval</a>(). It keeps track of these properties in case the user changes the desktop globally, for example through some kind of control panel.</li>
<li>It performs event handling, meaning that it receives events from the underlying window system and dispatches them to the relevant widgets. By using sendEvent() and postEvent() you can send your own events to widgets.</li>
<li>It parses common command line arguments and sets its internal state accordingly. See the <a href="qapplication.html#QApplication">constructor documentation</a> below for more details.</li>
<li>It defines the application's look and feel, which is encapsulated in a <a href="qstyle.html">QStyle</a> object. This can be changed at runtime with <a href="qapplication.html#setStyle">setStyle</a>().</li>
<li>It specifies how the application is to allocate colors. See setColorSpec() for details.</li>
<li>It provides localization of strings that are visible to the user via translate().</li>
<li>It provides some magical objects like the <a href="qapplication.html#desktop">desktop</a>() and the <a href="../qtgui/qguiapplication.html#clipboard">clipboard</a>().</li>
<li>It knows about the application's windows. You can ask which widget is at a certain position using <a href="qapplication.html#widgetAt">widgetAt</a>(), get a list of <a href="qapplication.html#topLevelWidgets">topLevelWidgets</a>() and <a href="qapplication.html#closeAllWindows">closeAllWindows</a>(), etc.</li>
<li>It manages the application's mouse cursor handling, see <a href="../qtgui/qguiapplication.html#setOverrideCursor">setOverrideCursor</a>()</li>
</ul>
<p>Since the <a href="qapplication.html">QApplication</a> object does so much initialization, it <i>must</i> be created before any other objects related to the user interface are created. <a href="qapplication.html">QApplication</a> also deals with common command line arguments. Hence, it is usually a good idea to create it <i>before</i> any interpretation or modification of <code>argv</code> is done in the application itself.</p>
<div class="table"><table class="generic">
 <thead><tr class="qt-style"><th  colspan="2">Groups of functions</th></tr></thead>
<tr valign="top" class="odd"><td >System settings</td><td ><a href="../qtgui/qguiapplication.html#desktopSettingsAware">desktopSettingsAware</a>(), <a href="../qtgui/qguiapplication.html#setDesktopSettingsAware">setDesktopSettingsAware</a>(), <a href="qapplication.html#cursorFlashTime-prop">cursorFlashTime</a>(), <a href="qapplication.html#cursorFlashTime-prop">setCursorFlashTime</a>(), <a href="qapplication.html#doubleClickInterval-prop">doubleClickInterval</a>(), <a href="qapplication.html#doubleClickInterval-prop">setDoubleClickInterval</a>(), <a href="qapplication.html#keyboardInputInterval-prop">setKeyboardInputInterval</a>(), <a href="qapplication.html#wheelScrollLines-prop">wheelScrollLines</a>(), <a href="qapplication.html#wheelScrollLines-prop">setWheelScrollLines</a>(), <a href="qapplication.html#palette">palette</a>(), <a href="qapplication.html#setPalette">setPalette</a>(), <a href="qapplication.html#font">font</a>(), <a href="qapplication.html#setFont">setFont</a>(), <a href="qapplication.html#fontMetrics">fontMetrics</a>().</td></tr>
<tr valign="top" class="even"><td >Event handling</td><td ><a href="qapplication.html#exec">exec</a>(), processEvents(), exit(), quit(). sendEvent(), postEvent(), sendPostedEvents(), removePostedEvents(), hasPendingEvents(), <a href="qapplication.html#notify">notify</a>().</td></tr>
<tr valign="top" class="odd"><td >GUI Styles</td><td ><a href="qapplication.html#style">style</a>(), <a href="qapplication.html#setStyle">setStyle</a>().</td></tr>
<tr valign="top" class="even"><td >Color usage</td><td >colorSpec(), setColorSpec().</td></tr>
<tr valign="top" class="odd"><td >Text handling</td><td >installTranslator(), removeTranslator() translate().</td></tr>
<tr valign="top" class="even"><td >Widgets</td><td ><a href="qapplication.html#allWidgets">allWidgets</a>(), <a href="qapplication.html#topLevelWidgets">topLevelWidgets</a>(), <a href="qapplication.html#desktop">desktop</a>(), <a href="qapplication.html#activePopupWidget">activePopupWidget</a>(), <a href="qapplication.html#activeModalWidget">activeModalWidget</a>(), <a href="../qtgui/qguiapplication.html#clipboard">clipboard</a>(), <a href="qapplication.html#focusWidget">focusWidget</a>(), <a href="qapplication.html#activeWindow">activeWindow</a>(), <a href="qapplication.html#widgetAt">widgetAt</a>().</td></tr>
<tr valign="top" class="odd"><td >Advanced cursor handling</td><td ><a href="../qtgui/qguiapplication.html#overrideCursor">overrideCursor</a>(), <a href="../qtgui/qguiapplication.html#setOverrideCursor">setOverrideCursor</a>(), <a href="../qtgui/qguiapplication.html#restoreOverrideCursor">restoreOverrideCursor</a>().</td></tr>
<tr valign="top" class="even"><td >Miscellaneous</td><td ><a href="qapplication.html#closeAllWindows">closeAllWindows</a>(), startingUp(), closingDown().</td></tr>
</table></div>
</div>
<p><b>See also </b><a href="../qtcore/qcoreapplication.html">QCoreApplication</a>, <a href="../qtcore/qabstracteventdispatcher.html">QAbstractEventDispatcher</a>, <a href="../qtcore/qeventloop.html">QEventLoop</a>, and <a href="../qtcore/qsettings.html">QSettings</a>.</p>
<!-- @@@QApplication -->
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$autoSipEnabled-prop$$$autoSipEnabled$$$setAutoSipEnabledconstbool -->
<h3 class="fn" id="autoSipEnabled-prop"><a name="autoSipEnabled-prop"></a><span class="name">autoSipEnabled</span> : <span class="type">bool</span></h3>
<p>toggles automatic SIP (software input panel) visibility</p>
<p>Set this property to <code>true</code> to automatically display the SIP when entering widgets that accept keyboard input. This property only affects widgets with the WA_InputMethodEnabled attribute set, and is typically used to launch a virtual keyboard on devices which have very few or no keys.</p>
<p><b> The property only has an effect on platforms that use software input panels.</b></p>
<p>The default is platform dependent.</p>
<p>This property was introduced in  Qt 4.5.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>autoSipEnabled</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setAutoSipEnabled</b></span>(const bool <i>enabled</i>)</td></tr>
</table></div>
<!-- @@@autoSipEnabled -->
<!-- $$$cursorFlashTime-prop$$$cursorFlashTime$$$setCursorFlashTimeint -->
<h3 class="fn" id="cursorFlashTime-prop"><a name="cursorFlashTime-prop"></a><span class="name">cursorFlashTime</span> : <span class="type">int</span></h3>
<p>This property holds the text cursor's flash (blink) time in milliseconds</p>
<p>The flash time is the time required to display, invert and restore the caret display. Usually the text cursor is displayed for half the cursor flash time, then hidden for the same amount of time, but this may vary.</p>
<p>The default value on X11 is 1000 milliseconds. On Windows, the <b>Control Panel</b> value is used and setting this property sets the cursor flash time for all applications.</p>
<p>We recommend that widgets do not cache this value as it may change at any time if the user changes the global desktop settings.</p>
<p><b>Note: </b>This property may hold a negative value, for instance if cursor blinking is disabled.</p><p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>cursorFlashTime</b></span>()</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setCursorFlashTime</b></span>(<i>int</i>)</td></tr>
</table></div>
<!-- @@@cursorFlashTime -->
<!-- $$$doubleClickInterval-prop$$$doubleClickInterval$$$setDoubleClickIntervalint -->
<h3 class="fn" id="doubleClickInterval-prop"><a name="doubleClickInterval-prop"></a><span class="name">doubleClickInterval</span> : <span class="type">int</span></h3>
<p>This property holds the time limit in milliseconds that distinguishes a double click from two consecutive mouse clicks</p>
<p>The default value on X11 is 400 milliseconds. On Windows and Mac OS, the operating system's value is used.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>doubleClickInterval</b></span>()</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setDoubleClickInterval</b></span>(<i>int</i>)</td></tr>
</table></div>
<!-- @@@doubleClickInterval -->
<!-- $$$globalStrut-prop$$$globalStrut$$$setGlobalStrutconstQSize& -->
<h3 class="fn" id="globalStrut-prop"><a name="globalStrut-prop"></a><span class="name">globalStrut</span> : <span class="type"><a href="../qtcore/qsize.html">QSize</a></span></h3>
<p>This property holds the minimum size that any GUI element that the user can interact with should have</p>
<p>For example, no button should be resized to be smaller than the global strut size. The strut size should be considered when reimplementing GUI controls that may be used on touch-screens or similar I/O devices.</p>
<p>Example:</p>
<pre class="cpp">

  <span class="type"><a href="../qtcore/qsize.html">QSize</a></span> MyWidget<span class="operator">::</span>sizeHint() <span class="keyword">const</span>
  {
      <span class="keyword">return</span> <span class="type"><a href="../qtcore/qsize.html">QSize</a></span>(<span class="number">80</span><span class="operator">,</span> <span class="number">25</span>)<span class="operator">.</span>expandedTo(<span class="type"><a href="qapplication.html#QApplication">QApplication</a></span><span class="operator">::</span>globalStrut());
  }

</pre>
<p>By default, this property contains a <a href="../qtcore/qsize.html">QSize</a> object with zero width and height.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QSize </td><td class="memItemRight bottomAlign"><span class="name"><b>globalStrut</b></span>()</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setGlobalStrut</b></span>(<i>const QSize &amp;</i>)</td></tr>
</table></div>
<!-- @@@globalStrut -->
<!-- $$$keyboardInputInterval-prop$$$keyboardInputInterval$$$setKeyboardInputIntervalint -->
<h3 class="fn" id="keyboardInputInterval-prop"><a name="keyboardInputInterval-prop"></a><span class="name">keyboardInputInterval</span> : <span class="type">int</span></h3>
<p>This property holds the time limit in milliseconds that distinguishes a key press from two consecutive key presses</p>
<p>The default value on X11 is 400 milliseconds. On Windows and Mac OS, the operating system's value is used.</p>
<p>This property was introduced in  Qt 4.2.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>keyboardInputInterval</b></span>()</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setKeyboardInputInterval</b></span>(<i>int</i>)</td></tr>
</table></div>
<!-- @@@keyboardInputInterval -->
<!-- $$$startDragDistance-prop$$$startDragDistance$$$setStartDragDistanceint -->
<h3 class="fn" id="startDragDistance-prop"><a name="startDragDistance-prop"></a><span class="name">startDragDistance</span> : <span class="type">int</span></h3>
<p>If you support drag and drop in your application, and want to start a drag and drop operation after the user has moved the cursor a certain distance with a button held down, you should use this property's value as the minimum distance required.</p>
<p>For example, if the mouse position of the click is stored in <code>startPos</code> and the current position (e.g&#x2e; in the mouse move event) is <code>currentPos</code>, you can find out if a drag should be started with code like this:</p>
<pre class="cpp">

  <span class="type">int</span> main(<span class="type">int</span> argc<span class="operator">,</span> <span class="type">char</span> <span class="operator">*</span>argv<span class="operator">[</span><span class="operator">]</span>)
  {
      <span class="type"><a href="qapplication.html#QApplication">QApplication</a></span><span class="operator">::</span>setDesktopSettingsAware(<span class="keyword">false</span>);
      <span class="type"><a href="qapplication.html#QApplication">QApplication</a></span> app(argc<span class="operator">,</span> argv);
      <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
      <span class="keyword">return</span> app<span class="operator">.</span>exec();
  }

</pre>
<p>Qt uses this value internally, e.g&#x2e; in <a href="qfiledialog.html">QFileDialog</a>.</p>
<p>The default value (if the platform doesn't provide a different default) is 10 pixels.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>startDragDistance</b></span>()</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setStartDragDistance</b></span>(int <i>l</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qapplication.html#startDragTime-prop">startDragTime</a>(), <a href="../qtcore/qpoint.html#manhattanLength">QPoint::manhattanLength</a>(), and <a href="graphicsview.html#drag-and-drop">Drag and Drop</a>.</p>
<!-- @@@startDragDistance -->
<!-- $$$startDragTime-prop$$$startDragTime$$$setStartDragTimeint -->
<h3 class="fn" id="startDragTime-prop"><a name="startDragTime-prop"></a><span class="name">startDragTime</span> : <span class="type">int</span></h3>
<p>This property holds the time in milliseconds that a mouse button must be held down before a drag and drop operation will begin</p>
<p>If you support drag and drop in your application, and want to start a drag and drop operation after the user has held down a mouse button for a certain amount of time, you should use this property's value as the delay.</p>
<p>Qt also uses this delay internally, e.g&#x2e; in <a href="qtextedit.html">QTextEdit</a> and <a href="qlineedit.html">QLineEdit</a>, for starting a drag.</p>
<p>The default value is 500 ms.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>startDragTime</b></span>()</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setStartDragTime</b></span>(int <i>ms</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qapplication.html#startDragDistance-prop">startDragDistance</a>() and <a href="graphicsview.html#drag-and-drop">Drag and Drop</a>.</p>
<!-- @@@startDragTime -->
<!-- $$$styleSheet-prop$$$styleSheet$$$setStyleSheetconstQString& -->
<h3 class="fn" id="styleSheet-prop"><a name="styleSheet-prop"></a><span class="name">styleSheet</span> : <span class="type"><a href="../qtcore/qstring.html">QString</a></span></h3>
<p>This property holds the application style sheet</p>
<p>By default, this property returns an empty string unless the user specifies the <code>-stylesheet</code> option on the command line when running the application.</p>
<p>This property was introduced in  Qt 4.2.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QString </td><td class="memItemRight bottomAlign"><span class="name"><b>styleSheet</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setStyleSheet</b></span>(const QString &amp;<i>sheet</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qwidget.html#setStyle">QWidget::setStyle</a>() and <a href="stylesheet.html">Qt Style Sheets</a>.</p>
<!-- @@@styleSheet -->
<!-- $$$wheelScrollLines-prop$$$wheelScrollLines$$$setWheelScrollLinesint -->
<h3 class="fn" id="wheelScrollLines-prop"><a name="wheelScrollLines-prop"></a><span class="name">wheelScrollLines</span> : <span class="type">int</span></h3>
<p>This property holds the number of lines to scroll a widget, when the mouse wheel is rotated.</p>
<p>If the value exceeds the widget's number of visible lines, the widget should interpret the scroll operation as a single <i>page up</i> or <i>page down</i>. If the widget is an <a href="qabstractitemview.html">item view class</a>, then the result of scrolling one <i>line</i> depends on the setting of the widget's <a href="qabstractitemview.html#verticalScrollMode-prop">scroll mode</a>. Scroll one <i>line</i> can mean <a href="qabstractitemview.html#ScrollMode-enum">scroll one item</a> or <a href="qabstractitemview.html#ScrollMode-enum">scroll one pixel</a>.</p>
<p>By default, this property has a value of 3.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>wheelScrollLines</b></span>()</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setWheelScrollLines</b></span>(<i>int</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="../qtgui/qstylehints.html#wheelScrollLines-prop">QStyleHints::wheelScrollLines</a>().</p>
<!-- @@@wheelScrollLines -->
<!-- $$$windowIcon-prop$$$windowIcon$$$setWindowIconconstQIcon& -->
<h3 class="fn" id="windowIcon-prop"><a name="windowIcon-prop"></a><span class="name">windowIcon</span> : <span class="type"><a href="../qtgui/qicon.html">QIcon</a></span></h3>
<p>This property holds the default window icon</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QIcon </td><td class="memItemRight bottomAlign"><span class="name"><b>windowIcon</b></span>()</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setWindowIcon</b></span>(const QIcon &amp;<i>icon</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qwidget.html#windowIcon-prop">QWidget::setWindowIcon</a>() and Setting the Application Icon.</p>
<!-- @@@windowIcon -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QApplication[overload1]$$$QApplicationint&char** -->
<h3 class="fn" id="QApplication"><a name="QApplication"></a>QApplication::<span class="name">QApplication</span>(<span class="type">int</span> &amp;<i>argc</i>, <span class="type">char</span> **<i>argv</i>)</h3>
<p>Initializes the window system and constructs an application object with <i>argc</i> command line arguments in <i>argv</i>.</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="qapplication.html">QApplication</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>
<p>The global <code>qApp</code> pointer refers to this application object. Only one application object should be created.</p>
<p>This application object must be constructed before any <a href="../qtgui/qpaintdevice.html">paint devices</a> (including widgets, pixmaps, bitmaps etc.)&#x2e;</p>
<p><b>Note: </b><i>argc</i> and <i>argv</i> might be changed as Qt removes command line arguments that it recognizes.</p><p>All Qt programs automatically support the following command line options:</p>
<ul>
<li>-style= <i>style</i>, sets the application GUI style. Possible values depend on your system configuration. If you compiled Qt with additional styles or have additional styles as plugins these will be available to the <code>-style</code> command line option. You can also set the style for all Qt applications by setting the <code>QT_STYLE_OVERRIDE</code> environment variable.</li>
<li>-style <i>style</i>, is the same as listed above.</li>
<li>-stylesheet= <i>stylesheet</i>, sets the application <a href="stylesheet.html">styleSheet</a>. The value must be a path to a file that contains the Style Sheet.<p><b>Note: </b>Relative URLs in the Style Sheet file are relative to the Style Sheet file's path.</p></li>
<li>-stylesheet <i>stylesheet</i>, is the same as listed above.</li>
<li>-widgetcount, prints debug message at the end about number of widgets left undestroyed and maximum number of widgets existed at the same time</li>
<li>-reverse, sets the application's layout direction to <a href="../qtcore/qt.html#LayoutDirection-enum">Qt::RightToLeft</a></li>
<li>-qmljsdebugger=, activates the QML/JS debugger with a specified port. The value must be of format port:1234[,block], where block is optional and will make the application wait until a debugger connects to it.</li>
</ul>
<p><b>See also </b><a href="../qtcore/qcoreapplication.html#arguments">QCoreApplication::arguments</a>().</p>
<!-- @@@QApplication -->
<!-- $$$~QApplication[overload1]$$$~QApplication -->
<h3 class="fn" id="dtor.QApplication"><a name="dtor.QApplication"></a><code>[virtual] </code>QApplication::<span class="name">~QApplication</span>()</h3>
<p>Cleans up any window system resources that were allocated by this application. Sets the global variable <code>qApp</code> to 0.</p>
<!-- @@@~QApplication -->
<!-- $$$aboutQt[overload1]$$$aboutQt -->
<h3 class="fn" id="aboutQt"><a name="aboutQt"></a><code>[static slot] </code><span class="type">void</span> QApplication::<span class="name">aboutQt</span>()</h3>
<p>Displays a simple message box about Qt. The message includes the version number of Qt being used by the application.</p>
<p>This is useful for inclusion in the <b>Help</b> menu of an application, as shown in the <a href="qtwidgets-mainwindows-menus-example.html">Menus</a> example.</p>
<p>This function is a convenience slot for <a href="qmessagebox.html#aboutQt">QMessageBox::aboutQt</a>().</p>
<!-- @@@aboutQt -->
<!-- $$$activeModalWidget[overload1]$$$activeModalWidget -->
<h3 class="fn" id="activeModalWidget"><a name="activeModalWidget"></a><code>[static] </code><span class="type"><a href="qwidget.html">QWidget</a></span> *QApplication::<span class="name">activeModalWidget</span>()</h3>
<p>Returns the active modal widget.</p>
<p>A modal widget is a special top-level widget which is a subclass of <a href="qdialog.html">QDialog</a> that specifies the modal parameter of the constructor as true. A modal widget must be closed before the user can continue with other parts of the program.</p>
<p>Modal widgets are organized in a stack. This function returns the active modal widget at the top of the stack.</p>
<p><b>See also </b><a href="qapplication.html#activePopupWidget">activePopupWidget</a>() and <a href="qapplication.html#topLevelWidgets">topLevelWidgets</a>().</p>
<!-- @@@activeModalWidget -->
<!-- $$$activePopupWidget[overload1]$$$activePopupWidget -->
<h3 class="fn" id="activePopupWidget"><a name="activePopupWidget"></a><code>[static] </code><span class="type"><a href="qwidget.html">QWidget</a></span> *QApplication::<span class="name">activePopupWidget</span>()</h3>
<p>Returns the active popup widget.</p>
<p>A popup widget is a special top-level widget that sets the <code>Qt::WType_Popup</code> widget flag, e.g&#x2e; the <a href="qmenu.html">QMenu</a> widget. When the application opens a popup widget, all events are sent to the popup. Normal widgets and modal widgets cannot be accessed before the popup widget is closed.</p>
<p>Only other popup widgets may be opened when a popup widget is shown. The popup widgets are organized in a stack. This function returns the active popup widget at the top of the stack.</p>
<p><b>See also </b><a href="qapplication.html#activeModalWidget">activeModalWidget</a>() and <a href="qapplication.html#topLevelWidgets">topLevelWidgets</a>().</p>
<!-- @@@activePopupWidget -->
<!-- $$$activeWindow[overload1]$$$activeWindow -->
<h3 class="fn" id="activeWindow"><a name="activeWindow"></a><code>[static] </code><span class="type"><a href="qwidget.html">QWidget</a></span> *QApplication::<span class="name">activeWindow</span>()</h3>
<p>Returns the application top-level window that has the keyboard input focus, or 0 if no application window has the focus. There might be an activeWindow() even if there is no <a href="qapplication.html#focusWidget">focusWidget</a>(), for example if no widget in that window accepts key events.</p>
<p><b>See also </b><a href="qapplication.html#setActiveWindow">setActiveWindow</a>(), <a href="qwidget.html#setFocus-1">QWidget::setFocus</a>(), <a href="qwidget.html#focus-prop">QWidget::hasFocus</a>(), and <a href="qapplication.html#focusWidget">focusWidget</a>().</p>
<!-- @@@activeWindow -->
<!-- $$$alert[overload1]$$$alertQWidget*int -->
<h3 class="fn" id="alert"><a name="alert"></a><code>[static] </code><span class="type">void</span> QApplication::<span class="name">alert</span>(<span class="type"><a href="qwidget.html">QWidget</a></span> *<i>widget</i>, <span class="type">int</span> <i>msec</i> = 0)</h3>
<p>Causes an alert to be shown for <i>widget</i> if the window is not the active window. The alert is shown for <i>msec</i> miliseconds. If <i>msec</i> is zero (the default), then the alert is shown indefinitely until the window becomes active again.</p>
<p>Currently this function does nothing on Qt for Embedded Linux.</p>
<p>On macOS, this works more at the application level and will cause the application icon to bounce in the dock.</p>
<p>On Windows, this causes the window's taskbar entry to flash for a time. If <i>msec</i> is zero, the flashing will stop and the taskbar entry will turn a different color (currently orange).</p>
<p>On X11, this will cause the window to be marked as &quot;demands attention&quot;, the window must not be hidden (i.e&#x2e; not have hide() called on it, but be visible in some sort of way) in order for this to work.</p>
<p>This function was introduced in  Qt 4.3.</p>
<!-- @@@alert -->
<!-- $$$allWidgets[overload1]$$$allWidgets -->
<h3 class="fn" id="allWidgets"><a name="allWidgets"></a><code>[static] </code><span class="type">QWidgetList</span> QApplication::<span class="name">allWidgets</span>()</h3>
<p>Returns a list of all the widgets in the application.</p>
<p>The list is empty (<a href="../qtcore/qlist.html#isEmpty">QList::isEmpty</a>()) if there are no widgets.</p>
<p><b>Note: </b>Some of the widgets may be hidden.</p><p>Example:</p>
<pre class="cpp">

  <span class="type">void</span> updateAllWidgets()
  {
      foreach (<span class="type"><a href="qwidget.html">QWidget</a></span> <span class="operator">*</span>widget<span class="operator">,</span> <span class="type"><a href="qapplication.html#QApplication">QApplication</a></span><span class="operator">::</span>allWidgets())
          widget<span class="operator">-</span><span class="operator">&gt;</span>update();
  }

</pre>
<p><b>See also </b><a href="qapplication.html#topLevelWidgets">topLevelWidgets</a>() and <a href="qwidget.html#visible-prop">QWidget::isVisible</a>().</p>
<!-- @@@allWidgets -->
<!-- $$$beep[overload1]$$$beep -->
<h3 class="fn" id="beep"><a name="beep"></a><code>[static] </code><span class="type">void</span> QApplication::<span class="name">beep</span>()</h3>
<p>Sounds the bell, using the default volume and sound. The function is <i>not</i> available in Qt for Embedded Linux.</p>
<!-- @@@beep -->
<!-- $$$closeAllWindows[overload1]$$$closeAllWindows -->
<h3 class="fn" id="closeAllWindows"><a name="closeAllWindows"></a><code>[static slot] </code><span class="type">void</span> QApplication::<span class="name">closeAllWindows</span>()</h3>
<p>Closes all top-level windows.</p>
<p>This function is particularly useful for applications with many top-level windows. It could, for example, be connected to a <b>Exit</b> entry in the <b>File</b> menu:</p>
<pre class="cpp">

      <span class="keyword">const</span> <span class="type"><a href="../qtgui/qicon.html">QIcon</a></span> exitIcon <span class="operator">=</span> <span class="type"><a href="../qtgui/qicon.html">QIcon</a></span><span class="operator">::</span>fromTheme(<span class="string">&quot;application-exit&quot;</span>);
      <span class="type"><a href="qaction.html">QAction</a></span> <span class="operator">*</span>exitAct <span class="operator">=</span> fileMenu<span class="operator">-</span><span class="operator">&gt;</span>addAction(exitIcon<span class="operator">,</span> tr(<span class="string">&quot;E&amp;xit&quot;</span>)<span class="operator">,</span> qApp<span class="operator">,</span> <span class="operator">&amp;</span><span class="type"><a href="qapplication.html#QApplication">QApplication</a></span><span class="operator">::</span>closeAllWindows);
      exitAct<span class="operator">-</span><span class="operator">&gt;</span>setShortcuts(<span class="type"><a href="../qtgui/qkeysequence.html">QKeySequence</a></span><span class="operator">::</span>Quit);
      exitAct<span class="operator">-</span><span class="operator">&gt;</span>setStatusTip(tr(<span class="string">&quot;Exit the application&quot;</span>));
      fileMenu<span class="operator">-</span><span class="operator">&gt;</span>addAction(exitAct);

</pre>
<p>The windows are closed in random order, until one window does not accept the close event. The application quits when the last window was successfully closed; this can be turned off by setting <a href="../qtgui/qguiapplication.html#quitOnLastWindowClosed-prop">quitOnLastWindowClosed</a> to false.</p>
<p><b>See also </b><a href="../qtgui/qguiapplication.html#quitOnLastWindowClosed-prop">quitOnLastWindowClosed</a>, <a href="../qtgui/qguiapplication.html#lastWindowClosed">lastWindowClosed</a>(), <a href="qwidget.html#close">QWidget::close</a>(), <a href="qwidget.html#closeEvent">QWidget::closeEvent</a>(), <a href="../qtgui/qguiapplication.html#lastWindowClosed">lastWindowClosed</a>(), <a href="../qtcore/qcoreapplication.html#quit">QCoreApplication::quit</a>(), <a href="qapplication.html#topLevelWidgets">topLevelWidgets</a>(), and <a href="qwidget.html#isWindow">QWidget::isWindow</a>().</p>
<!-- @@@closeAllWindows -->
<!-- $$$desktop[overload1]$$$desktop -->
<h3 class="fn" id="desktop"><a name="desktop"></a><code>[static] </code><span class="type"><a href="qdesktopwidget.html">QDesktopWidget</a></span> *QApplication::<span class="name">desktop</span>()</h3>
<p>Returns the desktop widget (also called the root window).</p>
<p>The desktop may be composed of multiple screens, so it would be incorrect, for example, to attempt to <i>center</i> some widget in the desktop's geometry. <a href="qdesktopwidget.html">QDesktopWidget</a> has various functions for obtaining useful geometries upon the desktop, such as <a href="qdesktopwidget.html#screenGeometry">QDesktopWidget::screenGeometry</a>() and <a href="qdesktopwidget.html#availableGeometry">QDesktopWidget::availableGeometry</a>().</p>
<p>On X11, it is also possible to draw on the desktop.</p>
<!-- @@@desktop -->
<!-- $$$event[overload1]$$$eventQEvent* -->
<h3 class="fn" id="event"><a name="event"></a><code>[protected] </code><span class="type">bool</span> QApplication::<span class="name">event</span>(<span class="type"><a href="../qtcore/qevent.html">QEvent</a></span> *<i>e</i>)</h3>
<!-- @@@event -->
<!-- $$$exec[overload1]$$$exec -->
<h3 class="fn" id="exec"><a name="exec"></a><code>[static] </code><span class="type">int</span> QApplication::<span class="name">exec</span>()</h3>
<p>Enters the main event loop and waits until exit() is called, then returns the value that was set to exit() (which is 0 if exit() is called via quit()).</p>
<p>It is necessary to call this function to start event handling. The main event loop receives events from the window system and dispatches these to the application widgets.</p>
<p>Generally, no user interaction can take place before calling exec(). As a special case, modal widgets like <a href="qmessagebox.html">QMessageBox</a> can be used before calling exec(), because modal widgets call exec() to start a local event loop.</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="../qtcore/qtimer.html">QTimer</a> with 0 timeout. More advanced idle processing schemes can be achieved using processEvents().</p>
<p>We recommend that you connect clean-up code to the <a href="../qtcore/qcoreapplication.html#aboutToQuit">aboutToQuit()</a> signal, instead of putting it in your application's <code>main()</code> function. This is because, on some platforms the QApplication::exec() call may not return. For example, on the Windows platform, when the user logs off, the system terminates the process after Qt closes all top-level windows. Hence, there is <i>no guarantee</i> that the application will have time to exit its event loop and execute code at the end of the <code>main()</code> function, after the QApplication::exec() call.</p>
<p><b>See also </b><a href="../qtgui/qguiapplication.html#quitOnLastWindowClosed-prop">quitOnLastWindowClosed</a>, <a href="../qtcore/qcoreapplication.html#quit">QCoreApplication::quit</a>(), <a href="../qtcore/qcoreapplication.html#exit">QCoreApplication::exit</a>(), <a href="../qtcore/qcoreapplication.html#processEvents">QCoreApplication::processEvents</a>(), and <a href="../qtcore/qcoreapplication.html#exec">QCoreApplication::exec</a>().</p>
<!-- @@@exec -->
<!-- $$$focusChanged[overload1]$$$focusChangedQWidget*QWidget* -->
<h3 class="fn" id="focusChanged"><a name="focusChanged"></a><code>[signal] </code><span class="type">void</span> QApplication::<span class="name">focusChanged</span>(<span class="type"><a href="qwidget.html">QWidget</a></span> *<i>old</i>, <span class="type"><a href="qwidget.html">QWidget</a></span> *<i>now</i>)</h3>
<p>This signal is emitted when the widget that has keyboard focus changed from <i>old</i> to <i>now</i>, i.e&#x2e;, because the user pressed the tab-key, clicked into a widget or changed the active window. Both <i>old</i> and <i>now</i> can be the null-pointer.</p>
<p>The signal is emitted after both widget have been notified about the change through <a href="../qtgui/qfocusevent.html">QFocusEvent</a>.</p>
<p>This function was introduced in  Qt 4.1.</p>
<p><b>See also </b><a href="qwidget.html#setFocus-1">QWidget::setFocus</a>(), <a href="qwidget.html#clearFocus">QWidget::clearFocus</a>(), and <a href="../qtcore/qt.html#FocusReason-enum">Qt::FocusReason</a>.</p>
<!-- @@@focusChanged -->
<!-- $$$focusWidget[overload1]$$$focusWidget -->
<h3 class="fn" id="focusWidget"><a name="focusWidget"></a><code>[static] </code><span class="type"><a href="qwidget.html">QWidget</a></span> *QApplication::<span class="name">focusWidget</span>()</h3>
<p>Returns the application widget that has the keyboard input focus, or 0 if no widget in this application has the focus.</p>
<p><b>See also </b><a href="qwidget.html#setFocus-1">QWidget::setFocus</a>(), <a href="qwidget.html#focus-prop">QWidget::hasFocus</a>(), <a href="qapplication.html#activeWindow">activeWindow</a>(), and <a href="qapplication.html#focusChanged">focusChanged</a>().</p>
<!-- @@@focusWidget -->
<!-- $$$font[overload1]$$$font -->
<h3 class="fn" id="font"><a name="font"></a><code>[static] </code><span class="type"><a href="../qtgui/qfont.html">QFont</a></span> QApplication::<span class="name">font</span>()</h3>
<p>Returns the default application font.</p>
<p><b>See also </b><a href="qapplication.html#setFont">setFont</a>(), <a href="qapplication.html#fontMetrics">fontMetrics</a>(), and <a href="qwidget.html#font-prop">QWidget::font</a>().</p>
<!-- @@@font -->
<!-- $$$font$$$fontconstQWidget* -->
<h3 class="fn" id="font-1"><a name="font-1"></a><code>[static] </code><span class="type"><a href="../qtgui/qfont.html">QFont</a></span> QApplication::<span class="name">font</span>(const <span class="type"><a href="qwidget.html">QWidget</a></span> *<i>widget</i>)</h3>
<p>This is an overloaded function.</p>
<p>Returns the default font for the <i>widget</i>.</p>
<p><b>See also </b><a href="qapplication.html#fontMetrics">fontMetrics</a>() and <a href="qwidget.html#font-prop">QWidget::setFont</a>().</p>
<!-- @@@font -->
<!-- $$$font$$$fontconstchar* -->
<h3 class="fn" id="font-2"><a name="font-2"></a><code>[static] </code><span class="type"><a href="../qtgui/qfont.html">QFont</a></span> QApplication::<span class="name">font</span>(const <span class="type">char</span> *<i>className</i>)</h3>
<p>This is an overloaded function.</p>
<p>Returns the font for widgets of the given <i>className</i>.</p>
<p><b>See also </b><a href="qapplication.html#setFont">setFont</a>() and <a href="qwidget.html#font-prop">QWidget::font</a>().</p>
<!-- @@@font -->
<!-- $$$fontMetrics[overload1]$$$fontMetrics -->
<h3 class="fn" id="fontMetrics"><a name="fontMetrics"></a><code>[static] </code><span class="type"><a href="../qtgui/qfontmetrics.html">QFontMetrics</a></span> QApplication::<span class="name">fontMetrics</span>()</h3>
<p>Returns display (screen) font metrics for the application font.</p>
<p><b>See also </b><a href="qapplication.html#font">font</a>(), <a href="qapplication.html#setFont">setFont</a>(), <a href="qwidget.html#fontMetrics">QWidget::fontMetrics</a>(), and <a href="../qtgui/qpainter.html#fontMetrics">QPainter::fontMetrics</a>().</p>
<!-- @@@fontMetrics -->
<!-- $$$isEffectEnabled[overload1]$$$isEffectEnabledQt::UIEffect -->
<h3 class="fn" id="isEffectEnabled"><a name="isEffectEnabled"></a><code>[static] </code><span class="type">bool</span> QApplication::<span class="name">isEffectEnabled</span>(<span class="type"><a href="../qtcore/qt.html#UIEffect-enum">Qt::UIEffect</a></span> <i>effect</i>)</h3>
<p>Returns <code>true</code> if <i>effect</i> is enabled; otherwise returns <code>false</code>.</p>
<p>By default, Qt will try to use the desktop settings. To prevent this, call <a href="../qtgui/qguiapplication.html#setDesktopSettingsAware">setDesktopSettingsAware</a>(false).</p>
<p><b>Note: </b>All effects are disabled on screens running at less than 16-bit color depth.</p><p><b>See also </b><a href="qapplication.html#setEffectEnabled">setEffectEnabled</a>() and <a href="../qtcore/qt.html#UIEffect-enum">Qt::UIEffect</a>.</p>
<!-- @@@isEffectEnabled -->
<!-- $$$navigationMode[overload1]$$$navigationMode -->
<h3 class="fn" id="navigationMode"><a name="navigationMode"></a><code>[static] </code><span class="type"><a href="../qtcore/qt.html#NavigationMode-enum">Qt::NavigationMode</a></span> QApplication::<span class="name">navigationMode</span>()</h3>
<p>Returns what kind of focus navigation Qt is using.</p>
<p>This feature is available in Qt for Embedded Linux only.</p>
<p>This function was introduced in  Qt 4.6.</p>
<p><b>See also </b><a href="qapplication.html#setNavigationMode">setNavigationMode</a>() and <a href="qapplication-obsolete.html#keypadNavigationEnabled">keypadNavigationEnabled</a>().</p>
<!-- @@@navigationMode -->
<!-- $$$notify[overload1]$$$notifyQObject*QEvent* -->
<h3 class="fn" id="notify"><a name="notify"></a><span class="type">bool</span> QApplication::<span class="name">notify</span>(<span class="type"><a href="../qtcore/qobject.html">QObject</a></span> *<i>receiver</i>, <span class="type"><a href="../qtcore/qevent.html">QEvent</a></span> *<i>e</i>)</h3>
<!-- @@@notify -->
<!-- $$$palette[overload1]$$$paletteconstQWidget* -->
<h3 class="fn" id="palette"><a name="palette"></a><code>[static] </code><span class="type"><a href="../qtgui/qpalette.html">QPalette</a></span> QApplication::<span class="name">palette</span>(const <span class="type"><a href="qwidget.html">QWidget</a></span> *<i>widget</i>)</h3>
<p>This is an overloaded function.</p>
<p>If a <i>widget</i> is passed, the default palette for the widget's class is returned. This may or may not be the application palette. In most cases there is no special palette for certain types of widgets, but one notable exception is the popup menu under Windows, if the user has defined a special background color for menus in the display settings.</p>
<p><b>See also </b><a href="qapplication.html#setPalette">setPalette</a>() and <a href="qwidget.html#palette-prop">QWidget::palette</a>().</p>
<!-- @@@palette -->
<!-- $$$palette$$$paletteconstchar* -->
<h3 class="fn" id="palette-1"><a name="palette-1"></a><code>[static] </code><span class="type"><a href="../qtgui/qpalette.html">QPalette</a></span> QApplication::<span class="name">palette</span>(const <span class="type">char</span> *<i>className</i>)</h3>
<p>This is an overloaded function.</p>
<p>Returns the palette for widgets of the given <i>className</i>.</p>
<p><b>See also </b><a href="qapplication.html#setPalette">setPalette</a>() and <a href="qwidget.html#palette-prop">QWidget::palette</a>().</p>
<!-- @@@palette -->
<!-- $$$setActiveWindow[overload1]$$$setActiveWindowQWidget* -->
<h3 class="fn" id="setActiveWindow"><a name="setActiveWindow"></a><code>[static] </code><span class="type">void</span> QApplication::<span class="name">setActiveWindow</span>(<span class="type"><a href="qwidget.html">QWidget</a></span> *<i>active</i>)</h3>
<p>Sets the active window to the <i>active</i> widget in response to a system event. The function is called from the platform specific event handlers.</p>
<p><b>Warning:</b> This function does <i>not</i> set the keyboard focus to the active widget. Call <a href="qwidget.html#activateWindow">QWidget::activateWindow</a>() instead.</p>
<p>It sets the <a href="qapplication.html#activeWindow">activeWindow</a>() and <a href="qapplication.html#focusWidget">focusWidget</a>() attributes and sends proper <a href="../qtcore/qevent.html#Type-enum">WindowActivate</a>/<a href="../qtcore/qevent.html#Type-enum">WindowDeactivate</a> and <a href="../qtcore/qevent.html#Type-enum">FocusIn</a>/<a href="../qtcore/qevent.html#Type-enum">FocusOut</a> events to all appropriate widgets. The window will then be painted in active state (e.g&#x2e; cursors in line edits will blink), and it will have tool tips enabled.</p>
<p><b>See also </b><a href="qapplication.html#activeWindow">activeWindow</a>() and <a href="qwidget.html#activateWindow">QWidget::activateWindow</a>().</p>
<!-- @@@setActiveWindow -->
<!-- $$$setEffectEnabled[overload1]$$$setEffectEnabledQt::UIEffectbool -->
<h3 class="fn" id="setEffectEnabled"><a name="setEffectEnabled"></a><code>[static] </code><span class="type">void</span> QApplication::<span class="name">setEffectEnabled</span>(<span class="type"><a href="../qtcore/qt.html#UIEffect-enum">Qt::UIEffect</a></span> <i>effect</i>, <span class="type">bool</span> <i>enable</i> = true)</h3>
<p>Enables the UI effect <i>effect</i> if <i>enable</i> is true, otherwise the effect will not be used.</p>
<p><b>Note: </b>All effects are disabled on screens running at less than 16-bit color depth.</p><p><b>See also </b><a href="qapplication.html#isEffectEnabled">isEffectEnabled</a>(), <a href="../qtcore/qt.html#UIEffect-enum">Qt::UIEffect</a>, and <a href="../qtgui/qguiapplication.html#setDesktopSettingsAware">setDesktopSettingsAware</a>().</p>
<!-- @@@setEffectEnabled -->
<!-- $$$setFont[overload1]$$$setFontconstQFont&constchar* -->
<h3 class="fn" id="setFont"><a name="setFont"></a><code>[static] </code><span class="type">void</span> QApplication::<span class="name">setFont</span>(const <span class="type"><a href="../qtgui/qfont.html">QFont</a></span> &amp;<i>font</i>, const <span class="type">char</span> *<i>className</i> = Q_NULLPTR)</h3>
<p>Changes the default application font to <i>font</i>. If <i>className</i> is passed, the change applies only to classes that inherit <i>className</i> (as reported by <a href="../qtcore/qobject.html#inherits">QObject::inherits</a>()).</p>
<p>On application start-up, the default font depends on the window system. It can vary depending on both the window system version and the locale. This function lets you override the default font; but overriding may be a bad idea because, for example, some locales need extra large fonts to support their special characters.</p>
<p><b>Warning:</b> Do not use this function in conjunction with <a href="stylesheet.html">Qt Style Sheets</a>. The font of an application can be customized using the &quot;font&quot; style sheet property. To set a bold font for all QPushButtons, set the application <a href="qapplication.html#styleSheet-prop">styleSheet</a>() as &quot;<a href="qpushbutton.html">QPushButton</a> { font: bold }&quot;</p>
<p><b>See also </b><a href="qapplication.html#font">font</a>(), <a href="qapplication.html#fontMetrics">fontMetrics</a>(), and <a href="qwidget.html#font-prop">QWidget::setFont</a>().</p>
<!-- @@@setFont -->
<!-- $$$setNavigationMode[overload1]$$$setNavigationModeQt::NavigationMode -->
<h3 class="fn" id="setNavigationMode"><a name="setNavigationMode"></a><code>[static] </code><span class="type">void</span> QApplication::<span class="name">setNavigationMode</span>(<span class="type"><a href="../qtcore/qt.html#NavigationMode-enum">Qt::NavigationMode</a></span> <i>mode</i>)</h3>
<p>Sets the kind of focus navigation Qt should use to <i>mode</i>.</p>
<p>This feature is available in Qt for Embedded Linux only.</p>
<p>This function was introduced in  Qt 4.6.</p>
<p><b>See also </b><a href="qapplication.html#navigationMode">navigationMode</a>() and <a href="qapplication-obsolete.html#keypadNavigationEnabled">keypadNavigationEnabled</a>().</p>
<!-- @@@setNavigationMode -->
<!-- $$$setPalette[overload1]$$$setPaletteconstQPalette&constchar* -->
<h3 class="fn" id="setPalette"><a name="setPalette"></a><code>[static] </code><span class="type">void</span> QApplication::<span class="name">setPalette</span>(const <span class="type"><a href="../qtgui/qpalette.html">QPalette</a></span> &amp;<i>palette</i>, const <span class="type">char</span> *<i>className</i> = Q_NULLPTR)</h3>
<p>Changes the default application palette to <i>palette</i>.</p>
<p>If <i>className</i> is passed, the change applies only to widgets that inherit <i>className</i> (as reported by <a href="../qtcore/qobject.html#inherits">QObject::inherits</a>()). If <i>className</i> is left 0, the change affects all widgets, thus overriding any previously set class specific palettes.</p>
<p>The palette may be changed according to the current GUI style in <a href="qstyle.html#polish">QStyle::polish</a>().</p>
<p><b>Warning:</b> Do not use this function in conjunction with <a href="stylesheet.html">Qt Style Sheets</a>. When using style sheets, the palette of a widget can be customized using the &quot;color&quot;, &quot;background-color&quot;, &quot;selection-color&quot;, &quot;selection-background-color&quot; and &quot;alternate-background-color&quot;.</p>
<p><b>Note: </b>Some styles do not use the palette for all drawing, for instance, if they make use of native theme engines. This is the case for the Windows XP, Windows Vista, and macOS styles.</p><p><b>See also </b><a href="qwidget.html#palette-prop">QWidget::setPalette</a>(), <a href="qapplication.html#palette">palette</a>(), and <a href="qstyle.html#polish">QStyle::polish</a>().</p>
<!-- @@@setPalette -->
<!-- $$$setStyle[overload1]$$$setStyleQStyle* -->
<h3 class="fn" id="setStyle"><a name="setStyle"></a><code>[static] </code><span class="type">void</span> QApplication::<span class="name">setStyle</span>(<span class="type"><a href="qstyle.html">QStyle</a></span> *<i>style</i>)</h3>
<p>Sets the application's GUI style to <i>style</i>. Ownership of the style object is transferred to <a href="qapplication.html">QApplication</a>, so <a href="qapplication.html">QApplication</a> will delete the style object on application exit or when a new style is set and the old style is still the parent of the application object.</p>
<p>Example usage:</p>
<pre class="cpp">

  <span class="type"><a href="qapplication.html#QApplication">QApplication</a></span><span class="operator">::</span>setStyle(<span class="type"><a href="qstylefactory.html">QStyleFactory</a></span><span class="operator">::</span>create(<span class="string">&quot;Fusion&quot;</span>));

</pre>
<p>When switching application styles, the color palette is set back to the initial colors or the system defaults. This is necessary since certain styles have to adapt the color palette to be fully style-guide compliant.</p>
<p>Setting the style before a palette has been set, i.e&#x2e;, before creating <a href="qapplication.html">QApplication</a>, will cause the application to use <a href="qstyle.html#standardPalette">QStyle::standardPalette</a>() for the palette.</p>
<p><b>Warning:</b> Qt style sheets are currently not supported for custom <a href="qstyle.html">QStyle</a> subclasses. We plan to address this in some future release.</p>
<p><b>See also </b><a href="qapplication.html#style">style</a>(), <a href="qstyle.html">QStyle</a>, <a href="qapplication.html#setPalette">setPalette</a>(), and <a href="../qtgui/qguiapplication.html#desktopSettingsAware">desktopSettingsAware</a>().</p>
<!-- @@@setStyle -->
<!-- $$$setStyle$$$setStyleconstQString& -->
<h3 class="fn" id="setStyle-1"><a name="setStyle-1"></a><code>[static] </code><span class="type"><a href="qstyle.html">QStyle</a></span> *QApplication::<span class="name">setStyle</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>style</i>)</h3>
<p>This is an overloaded function.</p>
<p>Requests a <a href="qstyle.html">QStyle</a> object for <i>style</i> from the <a href="qstylefactory.html">QStyleFactory</a>.</p>
<p>The string must be one of the <a href="qstylefactory.html#keys">QStyleFactory::keys</a>(), typically one of &quot;windows&quot;, &quot;fusion&quot;, &quot;windowsxp&quot;, or &quot;macintosh&quot;. Style names are case insensitive.</p>
<p>Returns 0 if an unknown <i>style</i> is passed, otherwise the <a href="qstyle.html">QStyle</a> object returned is set as the application's GUI style.</p>
<p><b>Warning:</b> To ensure that the application's style is set correctly, it is best to call this function before the <a href="qapplication.html">QApplication</a> constructor, if possible.</p>
<!-- @@@setStyle -->
<!-- $$$style[overload1]$$$style -->
<h3 class="fn" id="style"><a name="style"></a><code>[static] </code><span class="type"><a href="qstyle.html">QStyle</a></span> *QApplication::<span class="name">style</span>()</h3>
<p>Returns the application's style object.</p>
<p><b>See also </b><a href="qapplication.html#setStyle">setStyle</a>() and <a href="qstyle.html">QStyle</a>.</p>
<!-- @@@style -->
<!-- $$$topLevelAt[overload1]$$$topLevelAtconstQPoint& -->
<h3 class="fn" id="topLevelAt"><a name="topLevelAt"></a><code>[static] </code><span class="type"><a href="qwidget.html">QWidget</a></span> *QApplication::<span class="name">topLevelAt</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>point</i>)</h3>
<p>Returns the top-level widget at the given <i>point</i>; returns 0 if there is no such widget.</p>
<!-- @@@topLevelAt -->
<!-- $$$topLevelAt$$$topLevelAtintint -->
<h3 class="fn" id="topLevelAt-1"><a name="topLevelAt-1"></a><code>[static] </code><span class="type"><a href="qwidget.html">QWidget</a></span> *QApplication::<span class="name">topLevelAt</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>)</h3>
<p>This is an overloaded function.</p>
<p>Returns the top-level widget at the point (<i>x</i>, <i>y</i>); returns 0 if there is no such widget.</p>
<!-- @@@topLevelAt -->
<!-- $$$topLevelWidgets[overload1]$$$topLevelWidgets -->
<h3 class="fn" id="topLevelWidgets"><a name="topLevelWidgets"></a><code>[static] </code><span class="type">QWidgetList</span> QApplication::<span class="name">topLevelWidgets</span>()</h3>
<p>Returns a list of the top-level widgets (windows) in the application.</p>
<p><b>Note: </b>Some of the top-level widgets may be hidden, for example a tooltip if no tooltip is currently shown.</p><p>Example:</p>
<pre class="cpp">

  <span class="type">void</span> showAllHiddenTopLevelWidgets()
  {
      foreach (<span class="type"><a href="qwidget.html">QWidget</a></span> <span class="operator">*</span>widget<span class="operator">,</span> <span class="type"><a href="qapplication.html#QApplication">QApplication</a></span><span class="operator">::</span>topLevelWidgets()) {
          <span class="keyword">if</span> (widget<span class="operator">-</span><span class="operator">&gt;</span>isHidden())
              widget<span class="operator">-</span><span class="operator">&gt;</span>show();
      }
  }

</pre>
<p><b>See also </b><a href="qapplication.html#allWidgets">allWidgets</a>(), <a href="qwidget.html#isWindow">QWidget::isWindow</a>(), and <a href="qwidget.html#isHidden">QWidget::isHidden</a>().</p>
<!-- @@@topLevelWidgets -->
<!-- $$$widgetAt[overload1]$$$widgetAtconstQPoint& -->
<h3 class="fn" id="widgetAt"><a name="widgetAt"></a><code>[static] </code><span class="type"><a href="qwidget.html">QWidget</a></span> *QApplication::<span class="name">widgetAt</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>point</i>)</h3>
<p>Returns the widget at global screen position <i>point</i>, or 0 if there is no Qt widget there.</p>
<p>This function can be slow.</p>
<p><b>See also </b><a href="../qtgui/qcursor.html#pos">QCursor::pos</a>(), <a href="qwidget.html#grabMouse">QWidget::grabMouse</a>(), and <a href="qwidget.html#grabKeyboard">QWidget::grabKeyboard</a>().</p>
<!-- @@@widgetAt -->
<!-- $$$widgetAt$$$widgetAtintint -->
<h3 class="fn" id="widgetAt-1"><a name="widgetAt-1"></a><code>[static] </code><span class="type"><a href="qwidget.html">QWidget</a></span> *QApplication::<span class="name">widgetAt</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>)</h3>
<p>This is an overloaded function.</p>
<p>Returns the widget at global screen position (<i>x</i>, <i>y</i>), or 0 if there is no Qt widget there.</p>
<!-- @@@widgetAt -->
</div>
<div class="macros">
<h2>Macro Documentation</h2>
<!-- $$$qApp[overload1]$$$qApp -->
<h3 class="fn" id="qApp"><a name="qApp"></a><span class="name">qApp</span></h3>
<p>A global pointer referring to the unique application object. It is equivalent to <a href="../qtcore/qcoreapplication.html#instance">QCoreApplication::instance</a>(), but cast as a <a href="qapplication.html">QApplication</a> pointer, so only valid when the unique application object is a <a href="qapplication.html">QApplication</a>.</p>
<p><b>See also </b><a href="../qtcore/qcoreapplication.html#instance">QCoreApplication::instance</a>() and <a href="../qtgui/qguiapplication.html#qGuiApp">qGuiApp</a>.</p>
<!-- @@@qApp -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2017 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    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.<br>    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. </p>
</div>
</body>
</html>