Home · Overviews · Examples 

QApplication Class Reference
[com.trolltech.qt.gui module]

The QApplication class manages the GUI application's control flow and main settings. More...

Inherits QCoreApplication.


Detailed Description

The QApplication class manages the GUI application's control flow and main settings.

It contains the main event loop, where all events from the window system and other sources are processed and dispatched. It also handles the application's initialization and finalization, and provides session management. It also handles most system-wide and application-wide settings.

For any GUI application that uses Qt, there is precisely one QApplication object, no matter whether the application has 0, 1, 2 or more windows at any time. For non-GUI Qt applications, use QCoreApplication instead, which doesn't depend on the QtGui library.

The QApplication object is accessible through the instance function which return a pointer equivalent to the global qApp pointer.

QApplication's main areas of responsibility are:

Since the QApplication object does so much initialization, it must be created before any other objects related to the user interface are created.

Since it also deals with common command line arguments, it is usually a good idea to create it before any interpretation or modification of argv is done in the application itself.

Groups of functions
System settingsdesktopSettingsAware, setDesktopSettingsAware, cursorFlashTime, setCursorFlashTime, doubleClickInterval, setDoubleClickInterval, setKeyboardInputInterval, wheelScrollLines, setWheelScrollLines, palette, setPalette(), font, setFont(), fontMetrics.
Event handlingexec, processEvents, exit, quit. sendEvent, postEvent, sendPostedEvents, removePostedEvents, hasPendingEvents, notify, macEventFilter(), qwsEventFilter(), x11EventFilter(), x11ProcessEvent(), winEventFilter().
GUI Stylesstyle, setStyle.
Color usagecolorSpec, setColorSpec, qwsSetCustomColors().
Text handlinginstallTranslator, removeTranslator translate().
WidgetsallWidgets, topLevelWidgets, desktop, activePopupWidget, activeModalWidget, clipboard, focusWidget, winFocus(), activeWindow, widgetAt.
Advanced cursor handlingoverrideCursor(), setOverrideCursor, restoreOverrideCursor.
X Window System synchronizationflushX(), syncX.
Session managementisSessionRestored, sessionId, commitData, saveState.
MiscellaneouscloseAllWindows, startingUp, closingDown, type.

See also QCoreApplication, QAbstractEventDispatcher, QEventLoop, and QSettings.


Copyright © 2008 Trolltech Trademarks
Qt Jambi 4.3.5_01