qapplication.html 79.2 KB
Newer Older
xuebingbing's avatar
xuebingbing committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698
<?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.11</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 ><a href="../qtdoc/index.html">Qt 5.11</a></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.11.2 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="#reimplemented-public-functions">Reimplemented 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="#reimplemented-protected-functions">Reimplemented 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>
<li class="fn">5 properties inherited from <a href="../qtcore/qcoreapplication.html#properties">QCoreApplication</a></li>
<li class="fn">1 property inherited from <a href="../qtcore/qobject.html#properties">QObject</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"> QString </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#styleSheet-prop">styleSheet</a></b>() const</td></tr>
</table></div>
<a name="reimplemented-public-functions"></a>
<h2 id="reimplemented-public-functions">Reimplemented Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#notify">notify</a></b>(QObject *<i>receiver</i>, QEvent *<i>e</i>) override</td></tr>
</table></div>
<ul>
<li class="fn">9 public functions inherited from <a href="../qtgui/qguiapplication.html#public-functions">QGuiApplication</a></li>
<li class="fn">6 public functions inherited from <a href="../qtcore/qcoreapplication.html#public-functions">QCoreApplication</a></li>
<li class="fn">34 public functions inherited from <a href="../qtcore/qobject.html#public-functions">QObject</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>
<ul>
<li class="fn">1 public slot inherited from <a href="../qtcore/qcoreapplication.html#public-slots">QCoreApplication</a></li>
<li class="fn">1 public slot inherited from <a href="../qtcore/qobject.html#public-slots">QObject</a></li>
</ul>
<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">14 signals inherited from <a href="../qtgui/qguiapplication.html#signals">QGuiApplication</a></li>
<li class="fn">1 signal inherited from <a href="../qtcore/qcoreapplication.html#signals">QCoreApplication</a></li>
<li class="fn">2 signals inherited from <a href="../qtcore/qobject.html#signals">QObject</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> = 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> = 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">47 static public members inherited from <a href="../qtgui/qguiapplication.html#static-public-members">QGuiApplication</a></li>
<li class="fn">40 static public members inherited from <a href="../qtcore/qcoreapplication.html#static-public-members">QCoreApplication</a></li>
<li class="fn">10 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">QObject</a></li>
</ul>
<a name="reimplemented-protected-functions"></a>
<h2 id="reimplemented-protected-functions">Reimplemented Protected Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qapplication.html#event">event</a></b>(QEvent *<i>e</i>) override</td></tr>
</table></div>
<ul>
<li class="fn">1 protected function inherited from <a href="../qtgui/qguiapplication.html#protected-functions">QGuiApplication</a></li>
<li class="fn">1 protected function inherited from <a href="../qtcore/qcoreapplication.html#protected-functions">QCoreApplication</a></li>
<li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</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>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 public variable inherited from <a href="../qtgui/qguiapplication.html#public-variables">QGuiApplication</a></li>
<li class="fn">1 public variable inherited from <a href="../qtcore/qcoreapplication.html#public-variables">QCoreApplication</a></li>
<li class="fn">1 public variable inherited from <a href="../qtcore/qobject.html#public-variables">QObject</a></li>
<li class="fn">1 protected function inherited from <a href="../qtgui/qguiapplication.html#protected-functions">QGuiApplication</a></li>
<li class="fn">1 protected function inherited from <a href="../qtcore/qcoreapplication.html#protected-functions">QCoreApplication</a></li>
<li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li>
<li class="fn">2 protected variables inherited from <a href="../qtcore/qobject.html#protected-variables">QObject</a></li>
</ul>
<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-1">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-1">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-1">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 <a href="../qtcore/qcoreapplication.html#instance">instance</a>() 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 <a href="../qtcore/qcoreapplication.html#sendEvent">sendEvent</a>() and <a href="../qtcore/qcoreapplication.html#postEvent">postEvent</a>() 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>(), <a href="../qtcore/qcoreapplication.html#processEvents">processEvents</a>(), <a href="../qtcore/qcoreapplication.html#exit">exit</a>(), <a href="../qtcore/qcoreapplication.html#quit">quit</a>(). <a href="../qtcore/qcoreapplication.html#sendEvent">sendEvent</a>(), <a href="../qtcore/qcoreapplication.html#postEvent">postEvent</a>(), <a href="../qtcore/qcoreapplication.html#sendPostedEvents">sendPostedEvents</a>(), <a href="../qtcore/qcoreapplication.html#removePostedEvents">removePostedEvents</a>(), 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 ><a href="../qtcore/qcoreapplication.html#installTranslator">installTranslator</a>(), <a href="../qtcore/qcoreapplication.html#removeTranslator">removeTranslator</a>() 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>(), <a href="../qtcore/qcoreapplication.html#startingUp">startingUp</a>(), <a href="../qtcore/qcoreapplication.html#closingDown">closingDown</a>().</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="keyword">if</span> ((startPos <span class="operator">-</span> currentPos)<span class="operator">.</span>manhattanLength() <span class="operator">&gt;</span><span class="operator">=</span>
          <span class="type"><a href="qapplication.html#QApplication">QApplication</a></span><span class="operator">::</span>startDragDistance())
      startTheDrag();

</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 <a href="../qtdoc/appicon.html">Setting the Application Icon</a>.</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 <a href="../qtdoc/internationalization.html#macos">macOS</a>, 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> <a href="qapplication.html#qApp">qApp</a><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. QDesktopWidget 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>[override virtual 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>
<p>Reimplemented from <a href="../qtgui/qguiapplication.html#event">QGuiApplication::event</a>().</p>
<!-- @@@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 <a href="../qtcore/qcoreapplication.html#exit">exit</a>() is called, then returns the value that was set to <a href="../qtcore/qcoreapplication.html#exit">exit</a>() (which is 0 if <a href="../qtcore/qcoreapplication.html#exit">exit</a>() is called via <a href="../qtcore/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>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 <a href="../qtcore/qcoreapplication.html#processEvents">processEvents</a>().</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">Qt::UIEffect</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">Qt::NavigationMode</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><code>[override virtual] </code><span class="type">bool</span> QApplication::<span class="name">notify</span>(<span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>receiver</i>, <span class="type"><a href="../qtcore/qevent.html">QEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="../qtgui/qguiapplication.html#notify">QGuiApplication::notify</a>().</p>
<!-- @@@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">Qt::UIEffect</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> = 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">Qt::NavigationMode</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> = 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 Vista and <a href="../qtdoc/internationalization.html#macos">macOS</a> 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;windowsvista&quot;, &quot;fusion&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> 2018 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>