Qt 4.8
|
The QApplication class manages the GUI application's control flow and main settings. More...
#include <qapplication.h>
Public Types | |
enum | ColorSpec { NormalColor =0, CustomColor =1, ManyColor =2 } |
See setColorSpec() for full details. More... | |
enum | Type { Tty, GuiClient, GuiServer } |
Public Types inherited from QCoreApplication | |
enum | { ApplicationFlags } |
enum | Encoding { CodecForTr, UnicodeUTF8, DefaultCodec = CodecForTr } |
This enum type defines the 8-bit encoding of character string arguments to translate(): More... | |
typedef bool(* | EventFilter) (void *message, long *result) |
A function with the following signature that can be used as an event filter: More... | |
Public Slots | |
static void | aboutQt () |
Displays a simple message box about Qt. More... | |
int | autoMaximizeThreshold () const |
bool | autoSipEnabled () const |
static void | closeAllWindows () |
Closes all top-level windows. More... | |
void | setAutoMaximizeThreshold (const int threshold) |
void | setAutoSipEnabled (const bool enabled) |
void | setStyleSheet (const QString &sheet) |
Public Slots inherited from QCoreApplication | |
static void | quit () |
Tells the application to exit with return code 0 (success). More... | |
Public Slots inherited from QObject | |
void | deleteLater () |
Schedules this object for deletion. More... | |
Signals | |
void | commitDataRequest (QSessionManager &sessionManager) |
This signal deals with Session Management{session management}. More... | |
void | focusChanged (QWidget *old, QWidget *now) |
void | fontDatabaseChanged () |
This signal is emitted when application fonts are loaded or removed. More... | |
void | lastWindowClosed () |
This signal is emitted from QApplication::exec() when the last visible primary window (i. More... | |
void | saveStateRequest (QSessionManager &sessionManager) |
This signal deals with Session Management{session management}. More... | |
Signals inherited from QCoreApplication | |
void | aboutToQuit () |
This signal is emitted when the application is about to quit the main event loop, e. More... | |
void | unixSignal (int) |
This signal is emitted whenever a Unix signal is received by the application. More... | |
Signals inherited from QObject | |
void | destroyed (QObject *=0) |
This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More... | |
Public Functions | |
virtual void | commitData (QSessionManager &sm) |
This function deals with Session Management{session management}. More... | |
QInputContext * | inputContext () const |
Returns the QInputContext instance used by the application. More... | |
bool | isSessionRestored () const |
Returns true if the application has been restored from an earlier Session Management{session}; otherwise returns false. More... | |
virtual bool | macEventFilter (EventHandlerCallRef, EventRef) |
bool | notify (QObject *, QEvent *) |
Reimplemented Function More... | |
QApplication (int &argc, char **argv) | |
Initializes the window system and constructs an application object with argc command line arguments in argv. More... | |
QApplication (int &argc, char **argv, bool GUIenabled) | |
Constructs an application object with argc command line arguments in argv. More... | |
QApplication (int &argc, char **argv, Type) | |
Constructs an application object with argc command line arguments in argv. More... | |
QApplication (Display *dpy, Qt::HANDLE visual=0, Qt::HANDLE cmap=0) | |
Creates an application, given an already open display display. More... | |
QApplication (Display *dpy, int &argc, char **argv, Qt::HANDLE visual=0, Qt::HANDLE cmap=0) | |
Creates an application, given an already open display and using argc command line arguments in argv. More... | |
QApplication (QApplication::QS60MainApplicationFactory factory, int &argc, char **argv) | |
virtual bool | qwsEventFilter (QWSEvent *) |
This virtual function is only implemented under Qt for Embedded Linux. More... | |
int | qwsProcessEvent (QWSEvent *) |
void | qwsSetCustomColors (QRgb *colortable, int start, int numColors) |
Set Qt for Embedded Linux custom color table. More... | |
virtual void | saveState (QSessionManager &sm) |
This function deals with Session Management{session management}. More... | |
QString | sessionId () const |
Returns the current Session Management{session's} identifier. More... | |
QString | sessionKey () const |
Returns the session key in the current Session Management{session}. More... | |
void | setInputContext (QInputContext *) |
This function replaces the QInputContext instance used by the application with inputContext. More... | |
QString | styleSheet () const |
void | winFocus (QWidget *, bool) |
virtual int | x11ClientMessage (QWidget *, XEvent *, bool passive_only) |
virtual bool | x11EventFilter (XEvent *) |
int | x11ProcessEvent (XEvent *) |
This function does the core processing of individual X {event}s, normally by dispatching Qt events to the right destination. More... | |
virtual | ~QApplication () |
Cleans up any window system resources that were allocated by this application. More... | |
Public Functions inherited from QCoreApplication | |
bool | filterEvent (void *message, long *result) |
Sends message through the event filter that was set by setEventFilter(). More... | |
QCoreApplication (int &argc, char **argv) | |
Constructs a Qt kernel application. More... | |
EventFilter | setEventFilter (EventFilter filter) |
Replaces the event filter function for the QCoreApplication with filter and returns the pointer to the replaced event filter function. More... | |
virtual bool | winEventFilter (MSG *message, long *result) |
The message procedure calls this function for every message received. More... | |
~QCoreApplication () | |
Destroys the QCoreApplication object. More... | |
Public Functions inherited from QObject | |
bool | blockSignals (bool b) |
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More... | |
const QObjectList & | children () const |
Returns a list of child objects. More... | |
bool | connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const |
bool | disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0) |
bool | disconnect (const QObject *receiver, const char *member=0) |
void | dumpObjectInfo () |
Dumps information about signal connections, etc. More... | |
void | dumpObjectTree () |
Dumps a tree of children to the debug output. More... | |
QList< QByteArray > | dynamicPropertyNames () const |
Returns the names of all properties that were dynamically added to the object using setProperty(). More... | |
virtual bool | eventFilter (QObject *, QEvent *) |
Filters events if this object has been installed as an event filter for the watched object. More... | |
template<typename T > | |
T | findChild (const QString &aName=QString()) const |
Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More... | |
template<typename T > | |
QList< T > | findChildren (const QString &aName=QString()) const |
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More... | |
template<typename T > | |
QList< T > | findChildren (const QRegExp &re) const |
bool | inherits (const char *classname) const |
Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More... | |
void | installEventFilter (QObject *) |
Installs an event filter filterObj on this object. More... | |
bool | isWidgetType () const |
Returns true if the object is a widget; otherwise returns false. More... | |
void | killTimer (int id) |
Kills the timer with timer identifier, id. More... | |
virtual const QMetaObject * | metaObject () const |
Returns a pointer to the meta-object of this object. More... | |
void | moveToThread (QThread *thread) |
Changes the thread affinity for this object and its children. More... | |
QString | objectName () const |
QObject * | parent () const |
Returns a pointer to the parent object. More... | |
QVariant | property (const char *name) const |
Returns the value of the object's name property. More... | |
Q_INVOKABLE | QObject (QObject *parent=0) |
Constructs an object with parent object parent. More... | |
void | removeEventFilter (QObject *) |
Removes an event filter object obj from this object. More... | |
void | setObjectName (const QString &name) |
void | setParent (QObject *) |
Makes the object a child of parent. More... | |
bool | setProperty (const char *name, const QVariant &value) |
Sets the value of the object's name property to value. More... | |
void | setUserData (uint id, QObjectUserData *data) |
bool | signalsBlocked () const |
Returns true if signals are blocked; otherwise returns false. More... | |
int | startTimer (int interval) |
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More... | |
QThread * | thread () const |
Returns the thread in which the object lives. More... | |
QObjectUserData * | userData (uint id) const |
virtual | ~QObject () |
Destroys the object, deleting all its child objects. More... | |
Static Public Functions | |
static QWidget * | activeModalWidget () |
Returns the active modal widget. More... | |
static QWidget * | activePopupWidget () |
Returns the active popup widget. More... | |
static QWidget * | activeWindow () |
Returns the application top-level window that has the keyboard input focus, or 0 if no application window has the focus. More... | |
static void | alert (QWidget *widget, int duration=0) |
static QWidgetList | allWidgets () |
Returns a list of all the widgets in the application. More... | |
static void | beep () |
Sounds the bell, using the default volume and sound. More... | |
static void | changeOverrideCursor (const QCursor &) |
Changes the currently active application override cursor to cursor. More... | |
static QClipboard * | clipboard () |
Returns a pointer to the application global clipboard. More... | |
static int | colorSpec () |
Returns the color specification. More... | |
static int | cursorFlashTime () |
static QDesktopWidget * | desktop () |
Returns the desktop widget (also called the root window). More... | |
static bool | desktopSettingsAware () |
Returns true if Qt is set to use the system's standard colors, fonts, etc. More... | |
static int | doubleClickInterval () |
static int | exec () |
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()). More... | |
static QWidget * | focusWidget () |
Returns the application widget that has the keyboard input focus, or 0 if no widget in this application has the focus. More... | |
static QFont | font () |
Returns the default application font. More... | |
static QFont | font (const QWidget *) |
Returns the default font for the widget. More... | |
static QFont | font (const char *className) |
Returns the font for widgets of the given className. More... | |
static QFontMetrics | fontMetrics () |
Returns display (screen) font metrics for the application font. More... | |
static QSize | globalStrut () |
static bool | isEffectEnabled (Qt::UIEffect) |
Returns true if effect is enabled; otherwise returns false. More... | |
static bool | isLeftToRight () |
Returns true if the application's layout direction is Qt::LeftToRight; otherwise returns false. More... | |
static bool | isRightToLeft () |
Returns true if the application's layout direction is Qt::RightToLeft; otherwise returns false. More... | |
static Qt::LayoutDirection | keyboardInputDirection () |
Returns the current keyboard input direction. More... | |
static int | keyboardInputInterval () |
static QLocale | keyboardInputLocale () |
Returns the current keyboard input locale. More... | |
static Qt::KeyboardModifiers | keyboardModifiers () |
Returns the current state of the modifier keys on the keyboard. More... | |
static Qt::LayoutDirection | layoutDirection () |
static Qt::MouseButtons | mouseButtons () |
Returns the current state of the buttons on the mouse. More... | |
static QCursor * | overrideCursor () |
Strips out vertical alignment flags and transforms an alignment align of Qt::AlignLeft into Qt::AlignLeft or Qt::AlignRight according to the language used. More... | |
static QPalette | palette () |
Returns the application palette. More... | |
static QPalette | palette (const QWidget *) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.If a widget is passed, the default palette for the widget's class is returned. More... | |
static QPalette | palette (const char *className) |
Returns the palette for widgets of the given className. More... | |
static Qt::KeyboardModifiers | queryKeyboardModifiers () |
Queries and returns the state of the modifier keys on the keyboard. More... | |
static bool | quitOnLastWindowClosed () |
static void | restoreOverrideCursor () |
Undoes the last setOverrideCursor(). More... | |
static void | setActiveWindow (QWidget *act) |
Sets the active window to the active widget in response to a system event. More... | |
static void | setColorSpec (int) |
Sets the color specification for the application to spec. More... | |
static void | setCursorFlashTime (int) |
static void | setDesktopSettingsAware (bool) |
Sets whether Qt should use the system's standard colors, fonts, etc., to on. More... | |
static void | setDoubleClickInterval (int) |
static void | setEffectEnabled (Qt::UIEffect, bool enable=true) |
Enables the UI effect effect if enable is true, otherwise the effect will not be used. More... | |
static void | setFont (const QFont &, const char *className=0) |
Changes the default application font to font. More... | |
static void | setGlobalStrut (const QSize &) |
static void | setGraphicsSystem (const QString &) |
Sets the default graphics backend to system, which will be used for on-screen widgets and QPixmaps. More... | |
static void | setKeyboardInputInterval (int) |
static void | setLayoutDirection (Qt::LayoutDirection direction) |
static void | setOverrideCursor (const QCursor &) |
Use changeOverrideCursor(cursor) (if replace is true) or setOverrideCursor(cursor) (if replace is false). More... | |
static void | setPalette (const QPalette &, const char *className=0) |
Changes the default application palette to palette. More... | |
static void | setQuitOnLastWindowClosed (bool quit) |
static void | setStartDragDistance (int l) |
static void | setStartDragTime (int ms) |
static void | setStyle (QStyle *) |
Sets the application's GUI style to style. More... | |
static QStyle * | setStyle (const QString &) |
Requests a QStyle object for style from the QStyleFactory. More... | |
static void | setWheelScrollLines (int) |
static void | setWindowIcon (const QIcon &icon) |
static int | startDragDistance () |
static int | startDragTime () |
static QStyle * | style () |
Returns the application's style object. More... | |
static void | syncX () |
Synchronizes with the X server in the X11 implementation. More... | |
static QWidget * | topLevelAt (const QPoint &p) |
Returns the top-level widget at the given point; returns 0 if there is no such widget. More... | |
static QWidget * | topLevelAt (int x, int y) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the top-level widget at the point ({x}, {y}); returns 0 if there is no such widget. More... | |
static QWidgetList | topLevelWidgets () |
Returns a list of the top-level widgets (windows) in the application. More... | |
static Type | type () |
Returns the type of application (Tty , GuiClient, or GuiServer). More... | |
static int | wheelScrollLines () |
static QWidget * | widgetAt (const QPoint &p) |
Returns the widget at global screen position point, or 0 if there is no Qt widget there. More... | |
static QWidget * | widgetAt (int x, int y) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the widget at global screen position (x, y), or 0 if there is no Qt widget there. More... | |
static QIcon | windowIcon () |
static void | winMouseButtonUp () |
Static Public Functions inherited from QCoreApplication | |
static void | addLibraryPath (const QString &) |
Prepends path to the beginning of the library path list, ensuring that it is searched for libraries first. More... | |
static QString | applicationDirPath () |
Returns the directory that contains the application executable. More... | |
static QString | applicationFilePath () |
Returns the file path of the application executable. More... | |
static QString | applicationName () |
static qint64 | applicationPid () |
Returns the current process ID for the application. More... | |
static QString | applicationVersion () |
static QT_DEPRECATED int | argc () |
Use arguments(). More... | |
static QStringList | arguments () |
Returns the list of command-line arguments. More... | |
static QT_DEPRECATED char ** | argv () |
Use arguments() instead. More... | |
static bool | closingDown () |
Returns true if the application objects are being destroyed; otherwise returns false. More... | |
static int | exec () |
Enters the main event loop and waits until exit() is called. More... | |
static void | exit (int retcode=0) |
Tells the application to exit with a return code. More... | |
static void | flush () |
Flushes the platform specific event queues. More... | |
static bool | hasPendingEvents () |
This function returns true if there are pending events; otherwise returns false. More... | |
static void | installTranslator (QTranslator *messageFile) |
Adds the translation file translationFile to the list of translation files to be used for translations. More... | |
static QCoreApplication * | instance () |
Returns a pointer to the application's QCoreApplication (or QApplication) instance. More... | |
static QStringList | libraryPaths () |
Returns a list of paths that the application will search when dynamically loading libraries. More... | |
static QString | organizationDomain () |
static QString | organizationName () |
static void | postEvent (QObject *receiver, QEvent *event) |
Adds the event event, with the object receiver as the receiver of the event, to an event queue and returns immediately. More... | |
static void | postEvent (QObject *receiver, QEvent *event, int priority) |
static void | processEvents (QEventLoop::ProcessEventsFlags flags=QEventLoop::AllEvents) |
Processes all pending events for the calling thread according to the specified flags until there are no more events to process. More... | |
static void | processEvents (QEventLoop::ProcessEventsFlags flags, int maxtime) |
static void | removeLibraryPath (const QString &) |
Removes path from the library path list. More... | |
static void | removePostedEvents (QObject *receiver) |
Removes all events posted using postEvent() for receiver. More... | |
static void | removePostedEvents (QObject *receiver, int eventType) |
static void | removeTranslator (QTranslator *messageFile) |
Removes the translation file translationFile from the list of translation files used by this application. More... | |
static bool | sendEvent (QObject *receiver, QEvent *event) |
Sends event event directly to receiver receiver, using the notify() function. More... | |
static void | sendPostedEvents (QObject *receiver, int event_type) |
Immediately dispatches all events which have been previously queued with QCoreApplication::postEvent() and which are for the object receiver and have the event type event_type. More... | |
static void | sendPostedEvents () |
static void | setApplicationName (const QString &application) |
static void | setApplicationVersion (const QString &version) |
static void | setAttribute (Qt::ApplicationAttribute attribute, bool on=true) |
Sets the attribute attribute if on is true; otherwise clears the attribute. More... | |
static void | setLibraryPaths (const QStringList &) |
Sets the list of directories to search when loading libraries to paths. More... | |
static void | setOrganizationDomain (const QString &orgDomain) |
static void | setOrganizationName (const QString &orgName) |
static bool | startingUp () |
Returns true if an application object has not been created yet; otherwise returns false. More... | |
static bool | testAttribute (Qt::ApplicationAttribute attribute) |
Returns true if attribute attribute is set; otherwise returns false. More... | |
static QString | translate (const char *context, const char *key, const char *disambiguation=0, Encoding encoding=CodecForTr) |
static QString | translate (const char *context, const char *key, const char *disambiguation, Encoding encoding, int n) |
Returns the translation text for sourceText, by querying the installed translation files. More... | |
static void | watchUnixSignal (int signal, bool watch) |
Static Public Functions inherited from QObject | |
static bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection) |
Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More... | |
static bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
Disconnects signal in object sender from method in object receiver. More... | |
static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
static uint | registerUserData () |
static QString | tr (const char *sourceText, const char *comment=0, int n=-1) |
static QString | trUtf8 (const char *sourceText, const char *comment=0, int n=-1) |
Protected Functions | |
bool | compressEvent (QEvent *, QObject *receiver, QPostEventList *) |
bool | event (QEvent *) |
This virtual function receives events to an object and should return true if the event e was recognized and processed. More... | |
void | setArgs (int, char **) |
Protected Functions inherited from QCoreApplication | |
QCoreApplication (QCoreApplicationPrivate &p) | |
Protected Functions inherited from QObject | |
virtual void | childEvent (QChildEvent *) |
This event handler can be reimplemented in a subclass to receive child events. More... | |
virtual void | connectNotify (const char *signal) |
This virtual function is called when something has been connected to signal in this object. More... | |
virtual void | customEvent (QEvent *) |
This event handler can be reimplemented in a subclass to receive custom events. More... | |
virtual void | disconnectNotify (const char *signal) |
This virtual function is called when something has been disconnected from signal in this object. More... | |
QObject (QObjectPrivate &dd, QObject *parent=0) | |
int | receivers (const char *signal) const |
Returns the number of receivers connected to the signal. More... | |
QObject * | sender () const |
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More... | |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *) |
This event handler can be reimplemented in a subclass to receive timer events for the object. More... | |
Properties | |
int | autoMaximizeThreshold |
defines a threshold for auto maximizing widgets More... | |
bool | autoSipEnabled |
toggles automatic SIP (software input panel) visibility More... | |
int | cursorFlashTime |
the text cursor's flash (blink) time in milliseconds More... | |
int | doubleClickInterval |
the time limit in milliseconds that distinguishes a double click from two consecutive mouse clicks More... | |
QSize | globalStrut |
the minimum size that any GUI element that the user can interact with should have More... | |
int | keyboardInputInterval |
the time limit in milliseconds that distinguishes a key press from two consecutive key presses More... | |
Qt::LayoutDirection | layoutDirection |
the default layout direction for this application More... | |
bool | quitOnLastWindowClosed |
whether the application implicitly quits when the last window is closed. More... | |
int | startDragDistance |
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. More... | |
int | startDragTime |
the time in milliseconds that a mouse button must be held down before a drag and drop operation will begin More... | |
QString | styleSheet |
the application style sheet More... | |
int | wheelScrollLines |
the number of lines to scroll a widget, when the mouse wheel is rotated. More... | |
QIcon | windowIcon |
the default window icon More... | |
Additional Inherited Members | |
Static Public Variables inherited from QObject | |
static const QMetaObject | staticMetaObject |
This variable stores the meta-object for the class. More... | |
Protected Variables inherited from QObject | |
QScopedPointer< QObjectData > | d_ptr |
Static Protected Variables inherited from QObject | |
static const QMetaObject | staticQtMetaObject |
Related Functions inherited from QCoreApplication | |
void | qAddPostRoutine (QtCleanUpFunction ptr) |
Adds a global routine that will be called from the QApplication destructor. More... | |
removePostedEvents | |
Removes all events of the given eventType that were posted using postEvent() for receiver. More... | |
Related Functions inherited from QObject | |
T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QRegExp ®Exp)() |
T * | qobject_cast (QObject *object) |
QObjectList | |
void * | qt_find_obj_child (QObject *parent, const char *type, const QString &name) |
Returns a pointer to the object named name that inherits type and with a given parent. More... | |
The QApplication class manages the GUI application's control flow and main settings.
QApplication 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, finalization, and provides session management. In addition, QApplication handles most of the system-wide and application-wide settings.
For any GUI application using Qt, there is precisely one QApplication object, no matter whether the application has 0, 1, 2 or more windows at any given time. For non-GUI Qt applications, use QCoreApplication instead, as it does not depend on the QtGui library.
The QApplication object is accessible through the instance() function that returns a pointer equivalent to the global qApp pointer.
QApplication's main areas of responsibility are:
It initializes the application with the user's desktop settings such as palette(), font() and doubleClickInterval(). It keeps track of these properties in case the user changes the desktop globally, for example through some kind of control panel.
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.
It parses common command line arguments and sets its internal state accordingly. See the constructor documentation below for more details.
It defines the application's look and feel, which is encapsulated in a QStyle object. This can be changed at runtime with setStyle().
It specifies how the application is to allocate colors. See setColorSpec() for details.
It provides localization of strings that are visible to the user via translate().
It provides some magical objects like the desktop() and the clipboard().
It knows about the application's windows. You can ask which widget is at a certain position using widgetAt(), get a list of topLevelWidgets() and closeAllWindows(), etc.
It manages the application's mouse cursor handling, see setOverrideCursor()
On the X window system, it provides functions to flush and sync the communication stream, see flushX() and syncX().
Since the QApplication object does so much initialization, it must be created before any other objects related to the user interface are created. QApplication also deals with common command line arguments. Hence, it is usually a good idea to create it before any interpretation or modification of argv
is done in the application itself.
Definition at line 99 of file qapplication.h.
See setColorSpec() for full details.
Enumerator | |
---|---|
NormalColor | |
CustomColor | |
ManyColor |
Definition at line 148 of file qapplication.h.
enum QApplication::Type |
Enumerator | |
---|---|
Tty | |
GuiClient | |
GuiServer |
Definition at line 123 of file qapplication.h.
|
virtual |
Cleans up any window system resources that were allocated by this application.
Sets the global variable qApp
to 0.
Definition at line 1105 of file qapplication.cpp.
QApplication::QApplication | ( | int & | argc, |
char ** | argv | ||
) |
Initializes the window system and constructs an application object with argc command line arguments in argv.
The global qApp
pointer refers to this application object. Only one application object should be created.
This application object must be constructed before any paint devices (including widgets, pixmaps, bitmaps etc.).
Qt debugging options (not available if Qt was compiled without the QT_DEBUG flag defined):
See Debugging Techniques for a more detailed explanation.
All Qt programs automatically support the following command line options:
motif
, windows
, and platinum
. If you compiled Qt with additional styles or have additional styles as plugins these will be available to the -style
command line option. raster
and opengl
. The X11 version of Qt supports some traditional X11 command line options:
-font
font, defines the application font. The font should be specified using an X logical font description. Note that this option is ignored when Qt is built with fontconfig support enabled. -background
color, sets the default background color and an application palette (light and dark shades are calculated). -foreground
color, sets the default foreground color. -button
color, sets the default button color. TrueColor
, forces the application to use a TrueColor visual on an 8-bit display. onTheSpot
makes the input appear directly in the widget, while overTheSpot
makes the input appear in a box floating over the widget and is not inserted until the editing is done. If QApplication fails to open the X11 display, it will terminate the process. This behavior is consistent with most X11 applications.
Definition at line 739 of file qapplication.cpp.
Referenced by QApplication().
QApplication::QApplication | ( | int & | argc, |
char ** | argv, | ||
bool | GUIenabled | ||
) |
Constructs an application object with argc command line arguments in argv.
If GUIenabled is true, a GUI application is constructed, otherwise a non-GUI (console) application is created.
Set GUIenabled to false for programs without a graphical user interface that should be able to run without a window system.
On X11, the window system is initialized if GUIenabled is true. If GUIenabled is false, the application does not connect to the X server. On Windows and Mac OS, currently the window system is always initialized, regardless of the value of GUIenabled. This may change in future versions of Qt.
The following example shows how to create an application that uses a graphical interface when available.
Definition at line 773 of file qapplication.cpp.
QApplication::QApplication | ( | int & | argc, |
char ** | argv, | ||
Type | type | ||
) |
Constructs an application object with argc command line arguments in argv.
With Qt for Embedded Linux, passing QApplication::GuiServer for type makes this application the server (equivalent to running with the -qws
option).
Definition at line 796 of file qapplication.cpp.
QApplication::QApplication | ( | Display * | display, |
Qt::HANDLE | visual = 0 , |
||
Qt::HANDLE | colormap = 0 |
||
) |
Creates an application, given an already open display display.
If visual and colormap are non-zero, the application will use those values as the default Visual and Colormap contexts.
This function is only available on X11.
Definition at line 911 of file qapplication.cpp.
QApplication::QApplication | ( | Display * | display, |
int & | argc, | ||
char ** | argv, | ||
Qt::HANDLE | visual = 0 , |
||
Qt::HANDLE | colormap = 0 |
||
) |
Creates an application, given an already open display and using argc command line arguments in argv.
If visual and colormap are non-zero, the application will use those values as the default Visual and Colormap contexts.
This function is only available on X11.
Definition at line 944 of file qapplication.cpp.
QApplication::QApplication | ( | QApplication::QS60MainApplicationFactory | factory, |
int & | argc, | ||
char ** | argv | ||
) |
|
staticslot |
Displays a simple message box about Qt.
The message includes the version number of Qt being used by the application.
This is useful for inclusion in the Help menu of an application, as shown in the Menus example.
This function is a convenience slot for QMessageBox::aboutQt().
Definition at line 2400 of file qapplication.cpp.
|
static |
Returns the active modal widget.
A modal widget is a special top-level widget which is a subclass of QDialog 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.
Modal widgets are organized in a stack. This function returns the active modal widget at the top of the stack.
Definition at line 1095 of file qapplication.cpp.
Referenced by closeAllWindows(), QApplicationPrivate::dispatchEnterLeave(), QWidget::event(), QAxServerBase::eventFilter(), QApplicationPrivate::globalEventProcessor(), qt_mac_mouse_inside_answer_rect(), qwsProcessEvent(), QSoftKeyManager::softkeySource(), QApplicationPrivate::tryModalHelper(), QGraphicsView::viewportEvent(), and QAxClientSite::windowActivationChange().
|
static |
Returns the active popup widget.
A popup widget is a special top-level widget that sets the Qt::WType_Popup
widget flag, e.g. the QMenu 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.
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.
Definition at line 1074 of file qapplication.cpp.
Referenced by QMenuPrivate::activateAction(), QShortcutMap::correctContext(), QApplicationPrivate::dispatchEnterLeave(), QToolBar::event(), QWidget::event(), QWidgetResizeHandler::eventFilter(), flipPoint(), QLineEdit::focusOutEvent(), QApplicationPrivate::globalEventProcessor(), QApplicationPrivate::isBlockedByModal(), QWidget::mousePressEvent(), notify(), QApplicationPrivate::notify_helper(), onApplicationChangedActivation(), qt_mac_handleTabletEvent(), QtWndProc(), qwsProcessEvent(), QTest::sendKeyEvent(), QApplicationPrivate::sendMouseEvent(), QWidgetPrivate::show_helper(), QSoftKeyManager::softkeySource(), QETWidget::translateMouseEvent(), QETWidget::translateWheelEvent(), QApplicationPrivate::tryModalHelper(), QGraphicsView::viewportEvent(), and x11ProcessEvent().
|
static |
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 focusWidget(), for example if no widget in that window accepts key events.
Definition at line 2334 of file qapplication.cpp.
Referenced by aboutQt(), QShortcutMap::correctContext(), QWidgetPrivate::deactivateWidgetCleanup(), QAccessibleApplication::doAction(), QApplicationPrivate::globalEventProcessor(), QBBNavigatorEventHandler::handleSwipeDown(), QBBScreenEventHandler::injectKeyboardEvent(), QAccessibleApplication::navigate(), onApplicationChangedActivation(), QPrintDialogPrivate::openWindowsPrintDialogModally(), QWidget::previousInFocusChain(), qstring_to_xtp(), qt_cleanup(), qt_qpa_set_cursor(), qt_try_modal(), qt_win_get_existing_directory(), qt_win_get_save_file_name(), qt_win_make_OFN(), QTest::sendKeyEvent(), QSoftKeyManager::softkeySource(), QAccessibleApplication::state(), QWindowsStyle::styleHint(), QBBButtonEventNotifier::updateButtonStates(), and QGraphicsView::viewportEvent().
|
static |
Causes an alert to be shown for widget if the window is not the active window. The alert is shown for msec miliseconds. If msec is zero (the default), then the alert is shown indefinitely until the window becomes active again.
Currently this function does nothing on Qt for Embedded Linux.
On Mac OS X, this works more at the application level and will cause the application icon to bounce in the dock.
On Windows, this causes the window's taskbar entry to flash for a time. If msec is zero, the flashing will stop and the taskbar entry will turn a different color (currently orange).
On X11, this will cause the window to be marked as "demands attention", the window must not be hidden (i.e. not have hide() called on it, but be visible in some sort of way) in order for this to work.
Definition at line 2741 of file qapplication_mac.mm.
Referenced by alert_widget(), parseGeometry(), and syncX().
|
static |
Returns a list of all the widgets in the application.
The list is empty (QList::isEmpty()) if there are no widgets.
Example:
Definition at line 2214 of file qapplication.cpp.
Referenced by QWidgetPrivate::frameStrut(), setFont(), QApplicationPrivate::setPalette_helper(), setStyle(), setWindowIcon(), topLevelWidgets(), update_toolbar_style(), and QGtkStyleUpdateScheduler::updateTheme().
|
slot |
Referenced by setAutoMaximizeThreshold().
|
slot |
Referenced by setAutoSipEnabled().
|
static |
Sounds the bell, using the default volume and sound.
The function is not available in Qt for Embedded Linux.
Definition at line 2736 of file qapplication_mac.mm.
Referenced by QApplicationPrivate::globalAppleEventProcessor(), QApplicationPrivate::globalEventProcessor(), QKeyMapperPrivate::isADeadKey(), QMenu::keyPressEvent(), parseGeometry(), qt_try_modal(), qt_win_getKeyboardModifiers(), and syncX().
|
static |
Changes the currently active application override cursor to cursor.
This function has no effect if setOverrideCursor() was not called.
Definition at line 3868 of file qapplication.cpp.
Referenced by QWhatsThisPrivate::eventFilter().
|
static |
Returns a pointer to the application global clipboard.
Definition at line 3336 of file qapplication.cpp.
Referenced by QTextControlPrivate::_q_copyLink(), QTextControl::canPaste(), QX11Data::clipboardWaitForEvent(), QLineControl::copy(), QTextControl::copy(), QmlJSDebugger::ToolBarColorBox::copyColorToClipboard(), QAccessibleTextWidget::copyText(), QAccessibleSimpleEditableTextInterface::copyText(), QLineEdit::createStandardContextMenu(), QAccessibleTextWidget::cutText(), QAccessibleSimpleEditableTextInterface::cutText(), QPlatformClipboard::emitChanged(), QDeclarativeTextEditPrivate::init(), QDeclarativeTextInputPrivate::init(), QMessageBox::keyPressEvent(), QAbstractItemView::keyPressEvent(), QTextControlPrivate::mouseReleaseEvent(), QLineEdit::mouseReleaseEvent(), QLineControl::paste(), QTextControl::paste(), QAccessibleTextWidget::pasteText(), QAccessibleSimpleEditableTextInterface::pasteText(), QLineControl::processMouseEvent(), QDeclarativeTextInput::q_canPasteChanged(), QClipboardINCRTransaction::QClipboardINCRTransaction(), qt_check_clipboard_sentinel(), qt_check_selection_sentinel(), QTextControlPrivate::setClipboardSelection(), and QClipboardINCRTransaction::x11Event().
|
staticslot |
Closes all top-level windows.
This function is particularly useful for applications with many top-level windows. It could, for example, be connected to a Exit entry in the File menu:
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 quitOnLastWindowClosed to false.
Definition at line 2369 of file qapplication.cpp.
Referenced by event().
|
static |
Returns the color specification.
Definition at line 1706 of file qapplication.cpp.
|
virtual |
This function deals with Session Management{session management}.
It is invoked when the QSessionManager wants the application to commit all its data.
Usually this means saving all open files, after getting permission from the user. Furthermore you may want to provide a means by which the user can cancel the shutdown.
You should not exit the application within this function. Instead, the session manager may or may not do this afterwards, depending on the context.
The default implementation requests interaction and sends a close event to all visible top-level widgets. If any event was rejected, the shutdown is canceled.
Definition at line 3592 of file qapplication.cpp.
|
signal |
This signal deals with Session Management{session management}.
It is emitted when the QSessionManager wants the application to commit all its data.
Usually this means saving all open files, after getting permission from the user. Furthermore you may want to provide a means by which the user can cancel the shutdown.
You should not exit the application within this signal. Instead, the session manager may or may not do this afterwards, depending on the context.
Referenced by commitData().
|
protectedvirtual |
Reimplemented from QCoreApplication.
Definition at line 1298 of file qapplication.cpp.
|
static |
Referenced by QLineEdit::event(), QLineEdit::focusInEvent(), QApplicationPrivate::qt_mac_apply_settings(), QTextControlPrivate::setBlinkingCursorEnabled(), setCursorFlashTime(), QDeclarativeTextInput::setCursorVisible(), QETWidget::translateCloseEvent(), QETWidget::translateGestureEvent(), QETWidget::updateRegion(), and QApplicationPrivate::x11_apply_settings().
|
static |
Returns the desktop widget (also called the root window).
The desktop may be composed of multiple screens, so it would be incorrect, for example, to attempt to center some widget in the desktop's geometry. QDesktopWidget has various functions for obtaining useful geometries upon the desktop, such as QDesktopWidget::screenGeometry() and QDesktopWidget::availableGeometry().
On X11, it is also possible to draw on the desktop.
Definition at line 3320 of file qapplication.cpp.
Referenced by QPushButtonPrivate::adjustedMenuPosition(), QWidgetPrivate::adjustedSize(), QDialog::adjustPosition(), QApplicationPrivate::applyX11SpecificCommandLineArguments(), QBalloonTip::balloon(), QVistaHelper::basicWindowFrameColor(), QWidgetPrivate::create_sys(), QApplicationPrivate::dispatchEnterLeave(), QVistaHelper::drawTitleText(), effectiveState(), QDockWidget::event(), find_trans_colors(), findRealWindow(), flipYCoordinate(), fontMetrics(), QClipboardWatcher::getDataInFormat(), getScreen(), QTipLabel::getTipScreen(), QTabWidget::heightForWidth(), QColorDialogPrivate::init(), QFontDialogPrivate::init(), QWidgetResizeHandler::keyPressEvent(), QWidgetPrivate::mapFromGlobal(), QWidgetPrivate::mapToGlobal(), QMenuBar::minimumSizeHint(), QWidgetResizeHandler::mouseMoveEvent(), QSizeGrip::mousePressEvent(), parseGeometry(), QWSOnScreenSurface::permanentState(), QTipLabel::placeTip(), QMenu::popup(), QMenuBarPrivate::popupAction(), QMenuPrivate::popupGeometry(), QComboBoxPrivate::popupGeometry(), QToolButtonPrivate::popupTimerDone(), QDateTimeEditPrivate::positionCalendarPopup(), QBalloonTip::QBalloonTip(), qstring_to_xtp(), qt_check_clipboard_sentinel(), qt_check_selection_sentinel(), qt_cleanup(), qt_grab_cursor(), qt_qpa_set_cursor(), QWhatsThat::QWhatsThat(), QWidget::restoreGeometry(), QDockAreaLayoutInfo::restoreState(), QAlphaWidget::run(), QWidget::saveGeometry(), QWhatsThisPrivate::say(), QWidgetPrivate::setGeometry_sys(), QApplicationPrivate::setMaxWindowRect(), QWidgetPrivate::setMinimumSize_helper(), QSplashScreen::setPixmap(), QApplicationPrivate::setScreenTransformation(), QWizardHeader::setup(), QWidget::setWindowState(), QWhatsThat::showEvent(), QCompleterPrivate::showPopup(), QComboBox::showPopup(), QToolTip::showText(), QWorkspace::sizeHint(), QProgressDialog::sizeHint(), QMdiArea::sizeHint(), QMenuBar::sizeHint(), QGraphicsView::sizeHint(), QTabWidget::sizeHint(), QWizard::sizeHint(), QWindowsXPStylePrivate::tabBody(), QPlatformScreen::topLevelAt(), QETWidget::translateConfigEvent(), QETWidget::translateTabletEvent(), QApplicationPrivate::translateTouchEvent(), QGLContext::updatePaintDevice(), QMessageBoxPrivate::updateSize(), and x11ProcessEvent().
|
static |
Returns true if Qt is set to use the system's standard colors, fonts, etc.
; otherwise returns false. The default is true.
Definition at line 3371 of file qapplication.cpp.
Referenced by QMdiSubWindowPrivate::desktopPalette(), QMacStyle::drawComplexControl(), QApplicationPrivate::globalEventProcessor(), onApplicationChangedActivation(), QGuiPlatformPlugin::palette(), QCommonStyle::pixelMetric(), QGuiPlatformPlugin::platformHint(), QWindowsStyle::polish(), QGtkStyle::polish(), qt_aqua_get_known_size(), qt_guiPlatformPlugin(), qt_init(), qt_set_qws_resources(), qt_set_x11_resources(), QtWndProc(), QWorkspaceTitleBarPrivate::readColors(), QMacStyle::sizeFromContents(), QCommonStyle::standardIconImplementation(), QCommonStyle::standardPixmap(), QMacStyle::subControlRect(), and QGtkStyle::unpolish().
|
static |
Referenced by QAbstractItemView::edit(), QWorkspace::eventFilter(), QTextControlPrivate::mouseDoubleClickEvent(), QLineEdit::mouseDoubleClickEvent(), QXlibWindow::mousePressEvent(), QComboBox::mousePressEvent(), QWorkspaceTitleBar::mousePressEvent(), QAbstractItemView::mousePressEvent(), QLineControl::processMouseEvent(), qt_cleanup(), QApplicationPrivate::qt_mac_apply_settings(), setDoubleClickInterval(), QETWidget::translateCloseEvent(), QETWidget::translateGestureEvent(), QETWidget::translateMouseEvent(), QETWidget::updateRegion(), and QApplicationPrivate::x11_apply_settings().
|
protectedvirtual |
This virtual function receives events to an object and should return true if the event e was recognized and processed.
The event() function can be reimplemented to customize the behavior of an object.
Reimplemented from QCoreApplication.
Definition at line 2504 of file qapplication.cpp.
Referenced by compressEvent(), notify(), and ~QApplication().
|
static |
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()).
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.
Generally, no user interaction can take place before calling exec(). As a special case, modal widgets like QMessageBox can be used before calling exec(), because modal widgets call exec() to start a local event loop.
To make your application perform idle processing, i.e., executing a special function whenever there are no pending events, use a QTimer with 0 timeout. More advanced idle processing schemes can be achieved using processEvents().
We recommend that you connect clean-up code to the QCoreApplication::aboutToQuit() signal, instead of putting it in your application's main()
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 no guarantee that the application will have time to exit its event loop and execute code at the end of the main()
function, after the QApplication::exec() call.
Definition at line 3916 of file qapplication.cpp.
Referenced by main().
This signal is emitted when the widget that has keyboard focus changed from old to now, i.e., because the user pressed the tab-key, clicked into a widget or changed the active window. Both old and now can be the null-pointer.
The signal is emitted after both widget have been notified about the change through QFocusEvent.
|
static |
Returns the application widget that has the keyboard input focus, or 0 if no widget in this application has the focus.
Definition at line 2228 of file qapplication.cpp.
Referenced by QAbstractItemViewPrivate::checkPersistentEditorFocus(), QApplicationPrivate::closePopup(), QWinInputContext::composition(), QShortcutMap::correctWidgetContext(), QXIMInputContext::create_xim(), QTreeView::drawRow(), QWinInputContext::endComposition(), QMotifStyle::event(), QMacStyle::event(), QStyledItemDelegate::eventFilter(), QItemDelegate::eventFilter(), QWidgetPrivate::frameStrut(), QApplicationPrivate::globalEventProcessor(), QBBScreenEventHandler::handleKeyboardEvent(), QWidget::hasFocus(), QWidgetPrivate::hide_helper(), QMenu::keyPressEvent(), QTabWidget::keyPressEvent(), QAbstractItemView::keyPressEvent(), QAbstractButtonPrivate::moveFocus(), qt_cleanup(), qt_try_modal(), QtWndProc(), QTest::sendKeyEvent(), QMdiSubWindowPrivate::setActive(), QWidget::setFocus(), QGraphicsItem::setInputMethodHints(), QMenuBarPrivate::setKeyboardMode(), QMdiSubWindowPrivate::setMaximizeMode(), QMdiSubWindow::showShaded(), QSoftKeyManager::softkeySource(), QAccessibleMdiSubWindow::state(), QETWidget::translateWheelEvent(), and QGraphicsItem::updateMicroFocus().
|
static |
Returns the default application font.
Definition at line 1982 of file qapplication.cpp.
Referenced by QPPDOptionsModel::data(), QVistaHelper::drawTitleBar(), QGraphicsWidget::event(), QWidget::event(), QFontDatabase::findFont(), QToolTip::font(), QTextItem::font(), QInputContext::font(), QFontDatabase::font(), font(), getFcPattern(), QGraphicsWidgetPrivate::initStyleOptionTitleBar(), loadFromDatabase(), loadWin(), QWidgetPrivate::naturalWidgetFont(), QGraphicsWidget::paintWindowFrame(), QMdiSubWindow::QMdiSubWindow(), QApplicationPrivate::qt_mac_apply_settings(), QWhatsThat::QWhatsThat(), QMdi::SimpleCascader::rearrange(), registerFont(), QWidgetBackingStore::removeDirtyWidget(), QFont::resolve(), QGraphicsScenePrivate::resolveFont(), setFont(), QGraphicsScene::setFont(), QApplicationPrivate::setSystemFont(), QWindowsVistaStyle::unpolish(), QMessageBoxPrivate::updateSize(), QGtkStyleUpdateScheduler::updateTheme(), and QApplicationPrivate::x11_apply_settings().
Returns the default font for the widget.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 2009 of file qapplication.cpp.
|
static |
Returns the font for widgets of the given className.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 2044 of file qapplication.cpp.
|
signal |
This signal is emitted when application fonts are loaded or removed.
|
static |
Returns display (screen) font metrics for the application font.
Definition at line 2345 of file qapplication.cpp.
Referenced by QDecorationWindows::region(), and QDecorationDefault::titleBarHeight().
|
static |
Referenced by QWindowsStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QTabBarPrivate::extraWidth(), QTabWidget::heightForWidth(), QMdiSubWindow::minimumSizeHint(), QMdiArea::minimumSizeHint(), QMenuBar::minimumSizeHint(), QAbstractSpinBox::minimumSizeHint(), QTabWidget::minimumSizeHint(), QLineEdit::minimumSizeHint(), QTabBar::minimumSizeHint(), QCommonStyle::pixelMetric(), QWindowsXPStyle::pixelMetric(), QWindowsStyle::pixelMetric(), QWindowsCEStyle::pixelMetric(), QWindowsMobileStyle::pixelMetric(), QMotifStyle::pixelMetric(), QMacStyle::pixelMetric(), QComboBoxPrivate::recomputeSizeHint(), QMenuPrivate::scrollerHeight(), setColorSpec(), QHeaderView::setDefaultSectionSize(), QSizeGrip::sizeHint(), QRadioButton::sizeHint(), QScrollBar::sizeHint(), QCheckBox::sizeHint(), QPushButton::sizeHint(), QToolBoxButton::sizeHint(), QDial::sizeHint(), QToolButton::sizeHint(), QSlider::sizeHint(), QMdiArea::sizeHint(), QMenuBar::sizeHint(), QAbstractSpinBox::sizeHint(), QTabWidget::sizeHint(), QLineEdit::sizeHint(), QMenu::sizeHint(), DetailButton::sizeHint(), QTabBar::sizeHint(), QDateTimeEdit::sizeHint(), QSplitterHandle::sizeHint(), QCommonStyle::subControlRect(), QWindowsMobileStyle::subControlRect(), QWindowsCEStyle::subControlRect(), QMotifStyle::subControlRect(), QMenuPrivate::updateActionRects(), and QExpandingLineEdit::updateMinimumWidth().
QInputContext * QApplication::inputContext | ( | ) | const |
Returns the QInputContext instance used by the application.
Definition at line 5719 of file qapplication.cpp.
Referenced by inputContext().
|
static |
Returns true if effect is enabled; otherwise returns false.
By default, Qt will try to use the desktop settings. To prevent this, call setDesktopSettingsAware(false).
Definition at line 2875 of file qapplication_mac.mm.
Referenced by QMenu::popup(), QComboBox::showPopup(), QToolTip::showText(), QTipLabel::timerEvent(), QETWidget::translateCloseEvent(), and QETWidget::updateRegion().
|
inlinestatic |
Returns true if the application's layout direction is Qt::LeftToRight; otherwise returns false.
Definition at line 234 of file qapplication.h.
|
inlinestatic |
Returns true if the application's layout direction is Qt::RightToLeft; otherwise returns false.
Definition at line 233 of file qapplication.h.
Referenced by do_size_hints(), QXlibWindow::doSizeHints(), QCleanlooksStyle::drawControl(), QGtkStyle::drawControl(), QAbstractScrollArea::event(), QPlainTextEdit::event(), getNetWmState(), QStyle::itemPixmapRect(), qDrawPlainRect(), qt_aqua_get_known_size(), QCommonStyle::standardIconImplementation(), and QCommonStyle::standardPixmap().
bool QApplication::isSessionRestored | ( | ) | const |
Returns true if the application has been restored from an earlier Session Management{session}; otherwise returns false.
Definition at line 3481 of file qapplication.cpp.
|
static |
Returns the current keyboard input direction.
Definition at line 5808 of file qapplication.cpp.
Referenced by QDeclarativeTextPrivate::determineHorizontalAlignment(), QDeclarativeTextEditPrivate::determineHorizontalAlignment(), QDeclarativeTextInputPrivate::determineHorizontalAlignment(), QTextEngine::isRightToLeft(), and QLineControl::layoutDirection().
|
static |
|
static |
Returns the current keyboard input locale.
Definition at line 5793 of file qapplication.cpp.
|
static |
Returns the current state of the modifier keys on the keyboard.
The current state is updated sychronously as the event queue is emptied of events that will spontaneously change the keyboard state (QEvent::KeyPress and QEvent::KeyRelease events).
It should be noted this may not reflect the actual keys held on the input device at the time of calling but rather the modifiers as last reported in one of the above events. If no keys are being held Qt::NoModifier is returned.
Definition at line 3390 of file qapplication.cpp.
Referenced by QFileDialogPrivate::_q_enterDirectory(), QDockWidget::event(), QToolBar::event(), QAbstractItemViewPrivate::extendedSelectionCommand(), findRealWindow(), handle_xdnd_position(), QX11Data::motifdndHandle(), QContextMenuEvent::QContextMenuEvent(), qt_cleanup(), qt_mac_dnd_update_action(), qt_mac_mouse_inside_answer_rect(), QCursor::setPos(), QMacStyle::styleHint(), QApplicationPrivate::translateRawTouchEvent(), QETWidget::translateTabletEvent(), and QX11Data::xdndHandleDrop().
|
signal |
This signal is emitted from QApplication::exec() when the last visible primary window (i.
e. window with no parent) with the Qt::WA_QuitOnClose attribute set is closed.
By default,
this attribute is set for all widgets except transient windows such as splash screens, tool windows, and popup menus
This feature can be turned off by setting quitOnLastWindowClosed to false.
|
static |
Referenced by QLayout::alignmentRect(), QFormLayoutPrivate::arrangeWidgets(), QWindowsCEStyle::drawComplexControl(), QStyle::drawItemPixmap(), QWindowsCEStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QBoxLayoutPrivate::effectiveMargins(), QDeclarativeApplication::eventFilter(), QPainterState::init(), QMessageBoxPrivate::init(), QErrorMessage::QErrorMessage(), QTextOption::QTextOption(), QDecorationStyled::region(), QGraphicsWidgetPrivate::resolveLayoutDirection(), QWidgetPrivate::resolveLayoutDirection(), QMessageBox::setInformativeText(), setLayoutDirection(), QDecorationStyled::titleBarHeight(), QMenuPrivate::updateLayoutDirection(), and QGraphicsLayoutPrivate::visualDirection().
|
virtual |
For the Carbon port, If you create an application that inherits QApplication and reimplement this function, you get direct access to all Carbon Events that Qt registers for from Mac OS X with this function being called with the caller and the event.
For the Cocoa port, If you create an application that inherits QApplication and reimplement this function, you get direct access to all Cocoa Events that Qt receives from Mac OS X with this function being called with the caller being 0 and the event being an NSEvent pointer:
NSEvent *e = reinterpret_cast<NSEvent *>(event);
Return true if you want to stop the event from being processed. Return false for normal event dispatching. The default implementation returns false.
Definition at line 2670 of file qapplication_mac.mm.
Referenced by QApplicationPrivate::globalEventProcessor().
|
static |
Returns the current state of the buttons on the mouse.
The current state is updated syncronously as the event queue is emptied of events that will spontaneously change the mouse state (QEvent::MouseButtonPress and QEvent::MouseButtonRelease events).
It should be noted this may not reflect the actual buttons held on the input device at the time of calling but rather the mouse buttons as last reported in one of the above events. If no mouse buttons are being held Qt::NoButton is returned.
Definition at line 3431 of file qapplication.cpp.
Referenced by QDockWidget::event(), QToolBar::event(), flipPoint(), QApplicationPrivate::globalEventProcessor(), handle_xdnd_position(), QX11Data::motifdndHandle(), QContextMenuEvent::QContextMenuEvent(), qt_mac_mouse_inside_answer_rect(), QTabBarPrivate::refresh(), QCursor::setPos(), and QX11Data::xdndHandleDrop().
Reimplemented Function
Reimplemented from QCoreApplication.
Definition at line 3926 of file qapplication.cpp.
|
static |
Strips out vertical alignment flags and transforms an alignment align of Qt::AlignLeft into Qt::AlignLeft or Qt::AlignRight according to the language used.
Returns the active application override cursor.
This function returns 0 if no application cursor has been defined (i.e. the internal cursor stack is empty).
Definition at line 3855 of file qapplication.cpp.
Referenced by effectiveState(), qt_mac_updateCursorWithWidgetUnderMouse(), qt_qpa_set_cursor(), qt_try_modal(), qt_win_set_cursor(), qt_x11_enforce_cursor(), QtWndProc(), and QETWidget::translateMouseEvent().
|
static |
Returns the application palette.
Definition at line 1807 of file qapplication.cpp.
Referenced by QMacStyle::drawControl(), QDeclarativeSystemPalette::event(), QWidget::event(), QComboMenuDelegate::getStyleOption(), QGtkStylePrivate::gtkWidgetPalette(), QTextHtmlParserNode::initializeProperties(), QApplicationPrivate::initializeWidgetPaletteHash(), QWidgetPrivate::naturalWidgetPalette(), QDecorationWindows::paint(), QDecorationDefault::paint(), palette(), QSvgIconEngine::pixmap(), QPixmapIconEngine::pixmap(), QWindowsStyle::polish(), QDeclarativeSystemPalette::QDeclarativeSystemPalette(), QRenderRule::QRenderRule(), QApplicationPrivate::qt_mac_apply_settings(), QGraphicsScenePrivate::resolvePalette(), QTextControlPrivate::setContent(), QGraphicsScene::setPalette(), QApplicationPrivate::setPalette_helper(), QInputContext::standardFormat(), and QMotifStyle::standardPixmap().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.If a widget 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.
Definition at line 1826 of file qapplication.cpp.
|
static |
Returns the palette for widgets of the given className.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1851 of file qapplication.cpp.
|
static |
Queries and returns the state of the modifier keys on the keyboard.
Unlike keyboardModifiers, this method returns the actual keys held on the input device at the time of calling the method.
It does not rely on the keypress events having been received by this process, which makes it possible to check the modifiers while moving a window, for instance. Note that in most cases, you should use keyboardModifiers(), which is faster and more accurate since it contains the state of the modifiers as they were when the currently processed event was received.
Definition at line 1436 of file qapplication_mac.mm.
Referenced by parseGeometry(), qt_win_getKeyboardModifiers(), syncX(), and QX11Data::xdndHandleDrop().
|
static |
Referenced by setQuitOnLastWindowClosed().
|
virtual |
This virtual function is only implemented under Qt for Embedded Linux.
If you create an application that inherits QApplication and reimplement this function, you get direct access to all QWS (Q Window System) events that the are received from the QWS master process. The events are passed in the event parameter.
Return true if you want to stop the event from being processed. Return false for normal event dispatching. The default implementation returns false.
Definition at line 3090 of file qapplication_qws.cpp.
int QApplication::qwsProcessEvent | ( | QWSEvent * | event | ) |
Definition at line 2712 of file qapplication_qws.cpp.
void QApplication::qwsSetCustomColors | ( | QRgb * | colorTable, |
int | start, | ||
int | numColors | ||
) |
Set Qt for Embedded Linux custom color table.
Qt for Embedded Linux on 8-bpp displays allocates a standard 216 color cube. The remaining 40 colors may be used by setting a custom color table in the QWS master process before any clients connect.
colorTable is an array of up to 40 custom colors. start is the starting index (0-39) and numColors is the number of colors to be set (1-40).
This method is non-portable. It is available only in Qt for Embedded Linux.
Definition at line 3095 of file qapplication_qws.cpp.
|
static |
Undoes the last setOverrideCursor().
If setOverrideCursor() has been called twice, calling restoreOverrideCursor() will activate the first cursor set. Calling this function a second time restores the original widgets' cursors.
Definition at line 1419 of file qapplication_mac.mm.
Referenced by QApplicationPrivate::applyX11SpecificCommandLineArguments(), QOleDropTarget::Drop(), findRealWindow(), parseGeometry(), QGuiEventDispatcherWin32::processEvents(), QAxSelect::QAxSelect(), QTextBrowserPrivate::setSource(), QDragManager::~QDragManager(), and QWhatsThisPrivate::~QWhatsThisPrivate().
|
virtual |
This function deals with Session Management{session management}.
It is invoked when the session manager wants the application to preserve its state for a future session.
For example, a text editor would create a temporary file that includes the current contents of its edit buffers, the location of the cursor and other aspects of the current editing session.
You should never exit the application within this function. Instead, the session manager may or may not do this afterwards, depending on the context. Futhermore, most session managers will very likely request a saved state immediately after the application has been started. This permits the session manager to learn about the application's restart policy.
Definition at line 3668 of file qapplication.cpp.
|
signal |
This signal deals with Session Management{session management}.
It is invoked when the session manager wants the application to preserve its state for a future session.
For example, a text editor would create a temporary file that includes the current contents of its edit buffers, the location of the cursor and other aspects of the current editing session.
You should never exit the application within this signal. Instead, the session manager may or may not do this afterwards, depending on the context. Futhermore, most session managers will very likely request a saved state immediately after the application has been started. This permits the session manager to learn about the application's restart policy.
Referenced by saveState().
QString QApplication::sessionId | ( | ) | const |
Returns the current Session Management{session's} identifier.
If the application has been restored from an earlier session, this identifier is the same as it was in that previous session. The session identifier is guaranteed to be unique both for different applications and for different instances of the same application.
Definition at line 3487 of file qapplication.cpp.
QString QApplication::sessionKey | ( | ) | const |
Returns the session key in the current Session Management{session}.
If the application has been restored from an earlier session, this key is the same as it was when the previous session ended.
The session key changes with every call of commitData() or saveState().
Definition at line 3493 of file qapplication.cpp.
|
static |
Sets the active window to the active widget in response to a system event.
The function is called from the platform specific event handlers.
It sets the activeWindow() and focusWidget() attributes and sends proper WindowActivate/WindowDeactivate and FocusIn/FocusOut events to all appropriate widgets. The window will then be painted in active state (e.g. cursors in line edits will blink), and it will have tool tips enabled.
Definition at line 2622 of file qapplication.cpp.
Referenced by QWidgetPrivate::deactivateWidgetCleanup(), QApplicationPrivate::globalEventProcessor(), onApplicationChangedActivation(), q_createNativeChildrenAndSetParent(), qt_cleanup(), QtWndProc(), and QX11EmbedWidget::x11Event().
|
protected |
Definition at line 3772 of file qapplication_qws.cpp.
|
slot |
Definition at line 1402 of file qapplication.cpp.
|
slot |
Definition at line 1413 of file qapplication.cpp.
|
static |
Sets the color specification for the application to spec.
The color specification controls how the application allocates colors when run on a display with a limited amount of colors, e.g. 8 bit / 256 color displays.
The color specification must be set before you create the QApplication object.
The options are:
QApplication::ManyColor. Use this option if your application is very color hungry, e.g., it requires thousands of colors.
Under X11 the effect is:
On Windows, Qt creates a Windows palette, and fills it with a color cube.
Be aware that the CustomColor and ManyColor choices may lead to colormap flashing: The foreground application gets (most) of the available colors, while the background windows will look less attractive.
Example:
Definition at line 1766 of file qapplication.cpp.
Referenced by QApplicationPrivate::qt_mac_apply_settings(), and QApplicationPrivate::x11_apply_settings().
|
static |
Definition at line 2792 of file qapplication_mac.mm.
Referenced by QApplicationPrivate::qt_mac_apply_settings(), QETWidget::translateCloseEvent(), QETWidget::translateGestureEvent(), QETWidget::updateRegion(), and QApplicationPrivate::x11_apply_settings().
|
static |
Sets whether Qt should use the system's standard colors, fonts, etc., to on.
By default, this is true.
This function must be called before creating the QApplication object, like this:
Definition at line 3360 of file qapplication.cpp.
|
static |
Definition at line 2802 of file qapplication_mac.mm.
Referenced by QApplicationPrivate::qt_mac_apply_settings(), QETWidget::translateCloseEvent(), QETWidget::translateGestureEvent(), QETWidget::updateRegion(), and QApplicationPrivate::x11_apply_settings().
|
static |
Enables the UI effect effect if enable is true, otherwise the effect will not be used.
Definition at line 2842 of file qapplication_mac.mm.
Referenced by QApplicationPrivate::qt_mac_apply_settings(), qt_set_x11_resources(), QETWidget::translateCloseEvent(), QETWidget::updateRegion(), and QApplicationPrivate::x11_apply_settings().
|
static |
Changes the default application font to font.
Use the two-argument overload instead.
If className is passed, the change applies only to classes that inherit className (as reported by QObject::inherits()).
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.
Definition at line 2075 of file qapplication.cpp.
Referenced by QApplicationPrivate::qt_mac_apply_settings(), qt_set_qws_resources(), qt_set_windows_font_resources(), QFont::resolve(), QToolTip::setFont(), and QApplicationPrivate::setSystemFont().
|
static |
Definition at line 1797 of file qapplication.cpp.
Referenced by QApplicationPrivate::qt_mac_apply_settings(), and QApplicationPrivate::x11_apply_settings().
|
static |
Sets the default graphics backend to system, which will be used for on-screen widgets and QPixmaps.
The available systems are "native"
, "raster"
and "opengl"
.
There are several ways to set the graphics backend, in order of decreasing precedence:
-graphicssystem
switch -graphicssystem
switch If the highest precedence switch sets an invalid name, the error will be ignored and the default backend will be used.
"opengl"
option is currently experimental. Definition at line 1684 of file qapplication.cpp.
Referenced by QMeeGoGraphicsSystem::switchToMeeGo(), and QMeeGoGraphicsSystem::switchToRaster().
void QApplication::setInputContext | ( | QInputContext * | inputContext | ) |
This function replaces the QInputContext instance used by the application with inputContext.
Qt takes ownership of the given inputContext.
Definition at line 5701 of file qapplication.cpp.
|
static |
Definition at line 2819 of file qapplication_mac.mm.
Referenced by QETWidget::translateCloseEvent(), QETWidget::translateGestureEvent(), and QETWidget::updateRegion().
|
static |
Definition at line 3804 of file qapplication.cpp.
Referenced by event(), and QApplicationPrivate::process_cmdline().
|
static |
Use changeOverrideCursor(cursor) (if replace is true) or setOverrideCursor(cursor) (if replace is false).
Sets the application override cursor to cursor.
Application override cursors are intended for showing the user that the application is in a special state, for example during an operation that might take some time.
This cursor will be displayed in all the application's widgets until restoreOverrideCursor() or another setOverrideCursor() is called.
Application cursors are stored on an internal stack. setOverrideCursor() pushes the cursor onto the stack, and restoreOverrideCursor() pops the active cursor off the stack. changeOverrideCursor() changes the curently active application override cursor.
Every setOverrideCursor() must eventually be followed by a corresponding restoreOverrideCursor(), otherwise the stack will never be emptied.
Example:
Definition at line 1407 of file qapplication_mac.mm.
Referenced by QApplicationPrivate::applyX11SpecificCommandLineArguments(), changeOverrideCursor(), parseGeometry(), QGuiEventDispatcherWin32::processEvents(), QAxSelect::QAxSelect(), QWhatsThisPrivate::QWhatsThisPrivate(), and QTextBrowserPrivate::setSource().
|
static |
Changes the default application palette to palette.
Use the two-argument overload instead.
If className is passed, the change applies only to widgets that inherit className (as reported by QObject::inherits()). If className is left 0, the change affects all widgets, thus overriding any previously set class specific palettes.
The palette may be changed according to the current GUI style in QStyle::polish().
Definition at line 1941 of file qapplication.cpp.
Referenced by QApplicationPrivate::initializeWidgetPaletteHash(), QApplicationPrivate::qt_mac_apply_settings(), setStyle(), QApplicationPrivate::setSystemPalette(), style(), and QGtkStyleUpdateScheduler::updateTheme().
|
static |
Definition at line 5328 of file qapplication.cpp.
Referenced by main().
|
static |
Definition at line 3715 of file qapplication.cpp.
|
static |
Definition at line 3679 of file qapplication.cpp.
|
static |
Sets the application's GUI style to style.
Ownership of the style object is transferred to QApplication, so QApplication 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.
Example usage:
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.
Setting the style before a palette has been set, i.e., before creating QApplication, will cause the application to use QStyle::standardPalette() for the palette.
Definition at line 1534 of file qapplication.cpp.
Referenced by QApplicationPrivate::qt_mac_apply_settings(), setStyle(), setStyleSheet(), and QApplicationPrivate::x11_apply_settings().
Requests a QStyle object for style from the QStyleFactory.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
The string must be one of the QStyleFactory::keys(), typically one of "windows", "motif", "cde", "plastique", "windowsxp", or "macintosh". Style names are case insensitive.
Returns 0 if an unknown style is passed, otherwise the QStyle object returned is set as the application's GUI style.
Definition at line 1647 of file qapplication.cpp.
|
slot |
Definition at line 1430 of file qapplication.cpp.
|
static |
Definition at line 2831 of file qapplication_mac.mm.
Referenced by QApplicationPrivate::qt_mac_apply_settings(), QETWidget::translateCloseEvent(), QETWidget::translateGestureEvent(), QETWidget::updateRegion(), and QApplicationPrivate::x11_apply_settings().
|
static |
Definition at line 2155 of file qapplication.cpp.
|
static |
Referenced by QDeclarativePathViewPrivate::handleMouseMoveEvent(), QDeclarativeFlickablePrivate::handleMouseMoveEvent(), QMenuPrivate::hasMouseMoved(), QDockWidgetPrivate::mouseMoveEvent(), QToolBarPrivate::mouseMoveEvent(), QTextControlPrivate::mouseMoveEvent(), QDeclarativeMouseArea::mouseMoveEvent(), QTabBar::mouseMoveEvent(), QHeaderView::mouseMoveEvent(), QLineEdit::mouseMoveEvent(), QGraphicsView::mouseMoveEvent(), QDeclarativeTextInput::mouseMoveEvent(), QAbstractItemView::mouseMoveEvent(), QColorWell::mouseMoveEvent(), QColorShowLabel::mouseMoveEvent(), QTextControlPrivate::mousePressEvent(), QLineEdit::mousePressEvent(), QToolBarAreaLayoutInfo::moveToolBar(), QLineControl::processMouseEvent(), setStartDragDistance(), and QDeclarativePinchArea::updatePinch().
|
static |
Referenced by QLineEdit::mousePressEvent(), and setStartDragTime().
|
static |
Returns the application's style object.
Definition at line 1454 of file qapplication.cpp.
Referenced by QStyleSheetStyle::baseStyle(), QItemDelegate::check(), QDialogButtonBoxPrivate::createButton(), QItemDelegate::doLayout(), QItemDelegate::drawCheck(), QItemDelegate::drawDisplay(), QItemDelegate::drawFocus(), drawTextItemDecoration(), QStyledItemDelegate::editorEvent(), QWizardPrivate::ensureButton(), QFileIconProviderPrivate::getIcon(), QTextControl::getPaintContext(), QFormLayoutPrivate::getStyle(), QTabBarPrivate::layoutTabs(), QDecorationStyled::paint(), QStyledItemDelegate::paint(), QColumnViewDelegate::paint(), QSvgIconEngine::pixmap(), QPixmapIconEngine::pixmap(), qt_mac_update_os_settings(), QtWndProc(), QDecorationStyled::region(), setActiveWindow(), QTextControl::setOverwriteMode(), setStyle(), QSystemTrayIconPrivate::showMessage_sys(), QStyledItemDelegate::sizeHint(), QMessageBoxPrivate::standardIcon(), QGraphicsWidget::style(), QGraphicsScene::style(), QWidget::style(), QGraphicsGridLayoutPrivate::styleInfo(), QGraphicsLinearLayoutPrivate::styleInfo(), QGraphicsAnchorLayoutPrivate::styleInfo(), QItemDelegate::textRectangle(), QTextControl::timerEvent(), QDecorationStyled::titleBarHeight(), QStyledItemDelegate::updateEditorGeometry(), and QMessageBoxPrivate::updateSize().
QString QApplication::styleSheet | ( | ) | const |
Referenced by setAutoSipEnabled(), and setStyleSheet().
|
static |
Synchronizes with the X server in the X11 implementation.
This normally takes some time. Does nothing on other platforms.
Definition at line 3029 of file qapplication_x11.cpp.
Referenced by event(), QWidgetResizeHandler::mouseMoveEvent(), QWidgetBackingStore::showYellowThing(), and QETWidget::translateConfigEvent().
Returns the top-level widget at the given point; returns 0 if there is no such widget.
Definition at line 1441 of file qapplication_mac.mm.
Referenced by QX11Data::findClientWindow(), parseGeometry(), qt_cleanup(), qt_qpa_set_cursor(), qt_win_getKeyboardModifiers(), QApplicationPrivate::translateRawTouchEvent(), and widgetAt().
|
inlinestatic |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the top-level widget at the point ({x}, {y}); returns 0 if there is no such widget.
Definition at line 196 of file qapplication.h.
Referenced by topLevelAt().
|
static |
Returns a list of the top-level widgets (windows) in the application.
Example:
Definition at line 2188 of file qapplication.cpp.
Referenced by QDialog::adjustPosition(), QApplicationPrivate::canQuit(), QKeyMapper::changeKeyboard(), QWidgetPrivate::close_helper(), closeAllWindows(), commitData(), QApplicationPrivate::enterModal(), event(), QX11Data::findClientWindow(), findWindowThatShouldDisplayMenubar(), QEventDispatcherMac::flush(), QApplicationPrivate::globalEventProcessor(), QApplicationPrivate::leaveModal(), QWhatsThisPrivate::notifyToplevels(), qt_cleanup(), qt_mac_should_disable_menu(), QtWndProc(), setActiveWindow(), setLayoutDirection(), QApplicationPrivate::setMaxWindowRect(), QApplicationPrivate::setScreenTransformation(), QPlatformScreen::topLevelAt(), and topLevelWidgets().
|
static |
Returns the type of application (Tty , GuiClient, or GuiServer).
The type is set when constructing the QApplication object.
Definition at line 1050 of file qapplication.cpp.
Referenced by attachLayer(), QVNCScreenPrivate::configure(), QAhiScreen::connect(), QQnxScreen::connect(), QLinuxFbScreen::connect(), createMemSurface(), QDirectFBScreen::createSurface(), QScreen::createSurface(), QDeclarativeItemModule::defineModule(), QDeclarativeUtilModule::defineModule(), QDeclarativeItemModule::defineModuleCompat(), QDeclarativeUtilModule::defineModuleCompat(), QWidgetPrivate::init(), notify(), QApplication(), QShapedPixmapWidget::QShapedPixmapWidget(), qt_cleanup(), qt_init(), qt_set_windows_resources(), QtWndProc(), and QDeclarativeValueTypeFactory::registerValueTypesCompat().
|
static |
Returns the widget at global screen position point, or 0 if there is no Qt widget there.
This function can be slow.
Definition at line 1242 of file qapplication.cpp.
Referenced by QCompleter::eventFilter(), flipPoint(), QApplicationPrivate::globalEventProcessor(), QApplicationPrivate::leaveModal_sys(), make_widget_eventUPP(), make_win_eventUPP(), parseGeometry(), qstring_to_xtp(), qt_mac_update_cursor(), qt_mac_update_cursor_at_global_pos(), qt_qpa_set_cursor(), QtWndProc(), QWhatsThisPrivate::QWhatsThisPrivate(), QApplicationPrivate::sendMouseEvent(), QWSServerPrivate::sendMouseEventUnfiltered(), QCursor::setPos(), QETWidget::translateMouseEvent(), QETWidget::translateTabletEvent(), QETWidget::translateWheelEvent(), and x11EventFilter().
|
inlinestatic |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the widget at global screen position (x, y), or 0 if there is no Qt widget there.
Definition at line 194 of file qapplication.h.
Referenced by widgetAt().
|
static |
void QApplication::winFocus | ( | QWidget * | widget, |
bool | gotFocus | ||
) |
If gotFocus is true, widget will become the active window. Otherwise the active window is reset to 0.
Definition at line 1407 of file qapplication_win.cpp.
|
static |
Definition at line 3033 of file qapplication_win.cpp.
Definition at line 3149 of file qapplication_x11.cpp.
|
virtual |
If you create an application that inherits QApplication and reimplement this function, you get direct access to all X events that the are received from the X server. The events are passed in the event parameter.
Return true if you want to stop the event from being processed. Return false for normal event dispatching. The default implementation returns false.
It is only the directly addressed messages that are filtered. You must install an event filter directly on the event dispatcher, which is returned by QAbstractEventDispatcher::instance(), to handle system wide messages.
Definition at line 3927 of file qapplication_x11.cpp.
int QApplication::x11ProcessEvent | ( | XEvent * | event | ) |
This function does the core processing of individual X {event}s, normally by dispatching Qt events to the right destination.
It returns 1 if the event was consumed by special handling, 0 if the event was consumed by normal handling, and -1 if the event was for an unrecognized widget.
Definition at line 3226 of file qapplication_x11.cpp.
|
friend |
Definition at line 401 of file qapplication.h.
Definition at line 409 of file qapplication.h.
|
friend |
Definition at line 415 of file qapplication.h.
|
friend |
Definition at line 416 of file qapplication.h.
Definition at line 400 of file qapplication.h.
|
friend |
Definition at line 410 of file qapplication.h.
|
friend |
Definition at line 419 of file qapplication.h.
|
friend |
Definition at line 395 of file qapplication.h.
|
friend |
Definition at line 396 of file qapplication.h.
|
friend |
Definition at line 397 of file qapplication.h.
|
friend |
Definition at line 394 of file qapplication.h.
|
friend |
Definition at line 413 of file qapplication.h.
Definition at line 406 of file qapplication.h.
Definition at line 405 of file qapplication.h.
|
friend |
Definition at line 407 of file qapplication.h.
|
friend |
Definition at line 402 of file qapplication.h.
Definition at line 398 of file qapplication.h.
|
friend |
Definition at line 403 of file qapplication.h.
|
friend |
Definition at line 399 of file qapplication.h.
|
friend |
Definition at line 414 of file qapplication.h.
|
private |
defines a threshold for auto maximizing widgets
The auto maximize threshold is only available as part of Qt for Windows CE.
This property defines a threshold for the size of a window as a percentage of the screen size. If the minimum size hint of a window exceeds the threshold, calling show() will cause the window to be maximized automatically.
Setting the threshold to 100 or greater means that the widget will always be maximized. Alternatively, setting the threshold to 50 means that the widget will be maximized only if the vertical minimum size hint is at least 50% of the vertical screen size.
Setting the threshold to -1 disables the feature.
On Windows CE the default is -1 (i.e., it is disabled). On Windows Mobile the default is 40.
Definition at line 118 of file qapplication.h.
|
private |
toggles automatic SIP (software input panel) visibility
Set this property to true
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.
The property only has an effect on platforms which use software input panels, such as Windows CE and Symbian.
The default is platform dependent.
Definition at line 120 of file qapplication.h.
|
private |
the text cursor's flash (blink) time in milliseconds
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.
The default value on X11 is 1000 milliseconds. On Windows, the Control Panel value is used and setting this property sets the cursor flash time for all applications.
We recommend that widgets do not cache this value as it may change at any time if the user changes the global desktop settings.
Definition at line 104 of file qapplication.h.
|
private |
the time limit in milliseconds that distinguishes a double click from two consecutive mouse clicks
The default value on X11 is 400 milliseconds. On Windows and Mac OS, the operating system's value is used. However, on Windows and Symbian OS, calling this function sets the double click interval for all applications.
Definition at line 105 of file qapplication.h.
|
private |
the minimum size that any GUI element that the user can interact with should have
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.
Example:
By default, this property contains a QSize object with zero width and height.
Definition at line 110 of file qapplication.h.
|
private |
the time limit in milliseconds that distinguishes a key press from two consecutive key presses
The default value on X11 is 400 milliseconds. On Windows and Mac OS, the operating system's value is used.
Definition at line 106 of file qapplication.h.
|
private |
the default layout direction for this application
On system start-up, the default layout direction depends on the application's language.
Definition at line 102 of file qapplication.h.
|
private |
whether the application implicitly quits when the last window is closed.
The default is true.
If this property is true, the applications quits when the last visible primary window (i.e. window with no parent) with the Qt::WA_QuitOnClose attribute set is closed. By default this attribute is set for all widgets except for sub-windows. Refer to Qt::WindowType for a detailed list of Qt::Window objects.
Definition at line 113 of file qapplication.h.
|
private |
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.
For example, if the mouse position of the click is stored in startPos
and the current position (e.g. in the mouse move event) is currentPos
, you can find out if a drag should be started with code like this:
Qt uses this value internally, e.g. in QFileDialog.
The default value is 4 pixels.
Definition at line 112 of file qapplication.h.
|
private |
the time in milliseconds that a mouse button must be held down before a drag and drop operation will begin
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.
Qt also uses this delay internally, e.g. in QTextEdit and QLineEdit, for starting a drag.
The default value is 500 ms.
Definition at line 111 of file qapplication.h.
|
private |
the application style sheet
By default, this property returns an empty string unless the user specifies the -stylesheet
option on the command line when running the application.
Definition at line 115 of file qapplication.h.
|
private |
the number of lines to scroll a widget, when the mouse wheel is rotated.
If the value exceeds the widget's number of visible lines, the widget should interpret the scroll operation as a single page up or page down. If the widget is an item view class, then the result of scrolling one line depends on the setting of the widget's scroll mode. Scroll one line can mean scroll one item or scroll one pixel.
By default, this property has a value of 3.
Definition at line 108 of file qapplication.h.
|
private |
the default window icon
Definition at line 103 of file qapplication.h.