Qyoto  4.0.5
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Properties
QtGui.QApplication Class Reference

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

Inheritance diagram for QtGui.QApplication:
Collaboration diagram for QtGui.QApplication:

Public Types

enum  ColorSpec { CustomColor = 1, ManyColor = 2, NormalColor = 0 }
  More...
 
enum  Type { GuiClient = 1, GuiServer = 2, Tty = 0 }
 
- Public Types inherited from QtCore.QCoreApplication
enum  Encoding { CodecForTr = 0, DefaultCodec = 0, UnicodeUTF8 = 1 }
  More...
 

Public Member Functions

override void CreateProxy ()
 
virtual void CommitData (QSessionManager sm)
 
 
override bool OnEvent (QEvent arg1)
 
 
new bool IsSessionRestored ()
 
 
override bool Notify (QObject arg1, QEvent arg2)
 
 
virtual void SaveState (QSessionManager sm)
 
 
new string SessionId ()
 
 
new string SessionKey ()
 
 
new void WinFocus (QWidget arg1, bool arg2)
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.QCoreApplication
new bool SetEventFilter (bool filter)
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.QObject
 QObject (QObject parent=null)
 
 
new bool BlockSignals (bool b)
 
 
new
System.Collections.Generic.List
< QObject
Children ()
 
 
new bool Connect (QObject sender, string signal, string member, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
 
 
new void DeleteLater ()
 
 
new bool Disconnect (QObject receiver, string member=null)
 
 
new bool Disconnect (string signal=null, QObject receiver=null, string member=null)
 
 
new void DumpObjectInfo ()
 
 
new void DumpObjectTree ()
 
 
new
System.Collections.Generic.List
< QByteArray
DynamicPropertyNames ()
 
 
virtual bool EventFilter (QObject arg1, QEvent arg2)
 
 
new bool Inherits (string classname)
 
 
new void InstallEventFilter (QObject arg1)
 
 
new bool IsWidgetType ()
 
 
new void KillTimer (int id)
 
 
new object Property (string name)
 
 
new void RemoveEventFilter (QObject arg1)
 
 
new bool SetProperty (string name, object value)
 
 
new void SetUserData (uint id, QObjectUserData data)
 
new bool SignalsBlocked ()
 
 
new int StartTimer (int interval)
 
 
new QObjectUserData UserData (uint id)
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.Qt
delegate QTextStream FuncQTextStreamQTextStream (QTextStream qTextStream)
 
delegate string FuncStringQByteArray (QByteArray qByteArray)
 
delegate QByteArray FuncQByteArrayString (string @string)
 
delegate void ActionQtMsgTypeString (QtMsgType qtMsgType, string @string)
 
delegate QObject FuncQObject ()
 

Static Public Member Functions

static void AboutQt ()
 
 
static QWidget ActiveModalWidget ()
 
 
static QWidget ActivePopupWidget ()
 
 
static void Alert (QWidget widget, int duration=0)
 
 
static
System.Collections.Generic.List
< QWidget
AllWidgets ()
 
 
static void Beep ()
 
 
static void ChangeOverrideCursor (QCursor arg1)
 
 
static QClipboard Clipboard ()
 
 
static void CloseAllWindows ()
 
 
static QDesktopWidget Desktop ()
 
 
static QWidget FocusWidget ()
 
 
static QFont Font ()
 
 
static QFont Font (QWidget arg1)
 
 
static QFont Font (string className)
 
 
static QFontMetrics FontMetrics ()
 
 
static bool IsEffectEnabled (Qt.UIEffect arg1)
 
 
static bool IsLeftToRight ()
 
 
static bool IsRightToLeft ()
 
 
static Qt.LayoutDirection KeyboardInputDirection ()
 
 
static QLocale KeyboardInputLocale ()
 
 
static Qt.KeyboardModifier KeyboardModifiers ()
 
 
static Qt.MouseButton MouseButtons ()
 
 
static QPalette Palette ()
 
 
static QPalette Palette (QWidget arg1)
 
 
static QPalette Palette (string className)
 
 
static Qt.KeyboardModifier QueryKeyboardModifiers ()
 
 
static void RestoreOverrideCursor ()
 
 
static void SetEffectEnabled (Qt.UIEffect arg1, bool enable=true)
 
 
static void SetFont (QFont arg1, string className=null)
 
 
static void SetGraphicsSystem (string arg1)
 
 
static void SetPalette (QPalette arg1, string className=null)
 
 
static QStyle SetStyle (string arg1)
 
 
static void SyncX ()
 
 
static QWidget TopLevelAt (QPoint p)
 
 
static QWidget TopLevelAt (int x, int y)
 
 
static
System.Collections.Generic.List
< QWidget
TopLevelWidgets ()
 
 
static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
static QApplication.Type type ()
 
 
static QWidget WidgetAt (QPoint p)
 
 
static QWidget WidgetAt (int x, int y)
 
 
static void WinMouseButtonUp ()
 
- Static Public Member Functions inherited from QtCore.QCoreApplication
static void AddLibraryPath (string arg1)
 
 
static string ApplicationDirPath ()
 
 
static string ApplicationFilePath ()
 
 
static long ApplicationPid ()
 
 
static int Argc ()
 
static
System.Collections.Generic.List
< string > 
Arguments ()
 
 
static Pointer< sbyte > Argv ()
 
static bool ClosingDown ()
 
 
static void Exit (int retcode=0)
 
 
static void Flush ()
 
 
static bool HasPendingEvents ()
 
 
static void InstallTranslator (QTranslator messageFile)
 
 
static QCoreApplication Instance ()
 
 
static void PostEvent (QObject receiver, QEvent @event)
 
 
static void PostEvent (QObject receiver, QEvent @event, int priority)
 
 
static void ProcessEvents (QEventLoop.ProcessEventsFlag flags=QEventLoop.ProcessEventsFlag.AllEvents)
 
 
static void ProcessEvents (QEventLoop.ProcessEventsFlag flags, int maxtime)
 
 
static void Quit ()
 
 
static void RemoveLibraryPath (string arg1)
 
 
static void RemovePostedEvents (QObject receiver)
 
 
static void RemovePostedEvents (QObject receiver, int eventType)
 
 
static void RemoveTranslator (QTranslator messageFile)
 
 
static bool SendEvent (QObject receiver, QEvent @event)
 
 
static void SendPostedEvents ()
 
 
static void SendPostedEvents (QObject receiver, int event_type)
 
 
static void SetAttribute (Qt.ApplicationAttribute attribute, bool on=true)
 
 
static bool StartingUp ()
 
 
static bool TestAttribute (Qt.ApplicationAttribute attribute)
 
 
static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
static string Translate (string context, string key, string disambiguation=null, QCoreApplication.Encoding encoding=QCoreApplication.Encoding.CodecForTr)
 
 
static string Translate (string context, string key, string disambiguation, QCoreApplication.Encoding encoding, int n)
 
 
- Static Public Member Functions inherited from QtCore.QObject
static bool Connect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod method, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
 
 
static bool Connect (QObject sender, string signal, QObject receiver, string member, Qt.ConnectionType arg5=Qt.ConnectionType.AutoConnection)
 
 
static bool Disconnect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod member)
 
 
static bool Disconnect (QObject sender, string signal, QObject receiver, string member)
 
 
static uint RegisterUserData ()
 
static string Tr (string s, string c=null)
 
 
static string Tr (string s, string c, int n)
 
 
static string TrUtf8 (string s, string c=null)
 
 
static string TrUtf8 (string s, string c, int n)
 
 
- Static Public Member Functions inherited from QtCore.Qt
static QDataStream Write (QDataStream s, object p)
 
static QDataStream Write (QDataStream arg1, QSizeF arg2)
 
static QTextStream Write (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Write (QDataStream arg1, QPoint arg2)
 
static QDataStream Write (QDataStream arg1, QLineF arg2)
 
static QDataStream Write (QDataStream arg1, QPointF arg2)
 
static QDataStream Write (QDataStream arg1, QChar arg2)
 
static QDataStream Write (QDataStream arg1, QByteArray arg2)
 
static QDataStream Write (QDataStream arg1, QEasingCurve arg2)
 
static QDataStream Write (QDataStream arg1, QRectF arg2)
 
static QDataStream Write (QDataStream arg1, QDateTime arg2)
 
static QDataStream Write (QDataStream arg1, QUrl arg2)
 
static QDataStream Write (QDataStream arg1, QTime arg2)
 
static QDataStream Write (QDataStream arg1, QLocale arg2)
 
static QDataStream Write (QDataStream arg1, QBitArray arg2)
 
static QDataStream Write (QDataStream arg1, QUuid arg2)
 
static QDataStream Write (QDataStream arg1, QLine arg2)
 
static QDataStream Write (QDataStream arg1, QDate arg2)
 
static QDataStream Write (QDataStream @out, QRegExp regExp)
 
static QDataStream Write (QDataStream arg1, QRect arg2)
 
static QDataStream Write (QDataStream arg1, QSize arg2)
 
static QDataStream Write (QDataStream s, QVariant.Type p)
 
static QDataStream Write (QDataStream arg1, string arg2)
 
static QDataStream Write (QDataStream @out, System.Collections.Generic.List< string > list)
 
static QDataStream Read (QDataStream arg1, QChar arg2)
 
static QDataStream Read (QDataStream arg1, QLocale arg2)
 
static QDataStream Read (QDataStream arg1, QRect arg2)
 
static QDataStream Read (QDataStream arg1, QEasingCurve arg2)
 
static QDataStream Read (QDataStream arg1, QDate arg2)
 
static QDataStream Read (QDataStream arg1, QUrl arg2)
 
static QDataStream Read (QDataStream arg1, QUuid arg2)
 
static QTextStream Read (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Read (QDataStream arg1, QLineF arg2)
 
static QDataStream Read (QDataStream arg1, QRectF arg2)
 
static QDataStream Read (QDataStream arg1, QPointF arg2)
 
static QDataStream Read (QDataStream arg1, QLine arg2)
 
static QDataStream Read (QDataStream arg1, QBitArray arg2)
 
static QDataStream Read (QDataStream arg1, QSize arg2)
 
static QDataStream Read (QDataStream arg1, QDateTime arg2)
 
static QDataStream Read (QDataStream arg1, QTime arg2)
 
static QDataStream Read (QDataStream arg1, QPoint arg2)
 
static QDataStream Read (QDataStream @in, QRegExp regExp)
 
static QDataStream Read (QDataStream s, object p)
 
static QDataStream Read (QDataStream arg1, QByteArray arg2)
 
static QDataStream Read (QDataStream arg1, QSizeF arg2)
 
static QDataStream Read (QDataStream arg1, string arg2)
 
static QDataStream Read (QDataStream s, QVariant.Type p)
 
static QDataStream Read (QDataStream @in, System.Collections.Generic.List< string > list)
 
static double qAcos (double v)
 
static void qAddPostRoutine (System.Action arg1)
 
static string qAppName ()
 
static double qAsin (double v)
 
static double qAtan (double v)
 
static double qAtan2 (double x, double y)
 
static void qBadAlloc ()
 
static int qCeil (double v)
 
static ushort qChecksum (string s, uint len)
 
static QByteArray qCompress (QByteArray data)
 
static QByteArray qCompress (QByteArray data, int compressionLevel=-1)
 
static QByteArray qCompress (Pointer< byte > data, int nbytes)
 
static QByteArray qCompress (Pointer< byte > data, int nbytes, int compressionLevel=-1)
 
static double qCos (double v)
 
static double qExp (double v)
 
static double qFabs (double v)
 
static double qFastCos (double x)
 
static double qFastSin (double x)
 
static string qFlagLocation (string method)
 
static int qFloor (double v)
 
static bool qFuzzyCompare (double p1, double p2)
 
static bool qFuzzyCompare (float p1, float p2)
 
static bool qFuzzyIsNull (double d)
 
static bool qFuzzyIsNull (float f)
 
static uint qHash (QBitArray key)
 
static uint qHash (QChar key)
 
static uint qHash (QStringRef key)
 
static uint qHash (QUrl url)
 
static uint qHash (QPersistentModelIndex index)
 
static uint qHash (QByteArray key)
 
static uint qHash (QModelIndex index)
 
static uint qHash (uint key)
 
static uint qHash (sbyte key)
 
static uint qHash (byte key)
 
static uint qHash (short key)
 
static uint qHash (NativeLong key)
 
static uint qHash (ushort key)
 
static uint qHash (long key)
 
static uint qHash (ulong key)
 
static uint qHash (int key)
 
static uint qHash (string key)
 
static uint qHash (NativeULong key)
 
static double qInf ()
 
static Qt.ActionQtMsgTypeString qInstallMsgHandler (Qt.ActionQtMsgTypeString arg1)
 
static int qIntCast (float f)
 
static int qIntCast (double f)
 
static bool qIsFinite (double d)
 
static bool qIsFinite (float f)
 
static bool qIsInf (float f)
 
static bool qIsInf (double d)
 
static bool qIsNaN (float f)
 
static bool qIsNaN (double d)
 
static bool qIsNull (float f)
 
static bool qIsNull (double d)
 
static double qLn (double v)
 
static double qPow (double x, double y)
 
static double qQNaN ()
 
static void qRegisterStaticPluginInstanceFunction (Qt.FuncQObject function)
 
static void qRemovePostRoutine (System.Action arg1)
 
static int qRound (double d)
 
static long qRound64 (double d)
 
static double qSNaN ()
 
static bool qSharedBuild ()
 
static double qSin (double v)
 
static double qSqrt (double v)
 
static bool qStringComparisonHelper (QStringRef s1, string s2)
 
static double qTan (double v)
 
static QByteArray qUncompress (QByteArray data)
 
static QByteArray qUncompress (Pointer< byte > data, int nbytes)
 
static string qVersion ()
 
static void Qbswap_helper (Pointer< byte > src, Pointer< byte > dest, int size)
 
static QByteArray Qgetenv (string varName)
 
static bool Qputenv (string varName, QByteArray value)
 
static int Qrand ()
 
static void Qsrand (uint seed)
 
static int Qstrcmp (QByteArray str1, QByteArray str2)
 
static int Qstrcmp (QByteArray str1, string str2)
 
static int Qstrcmp (string str1, QByteArray str2)
 
static int Qstrcmp (string str1, string str2)
 
static Pointer< sbyte > Qstrcpy (Pointer< sbyte > dst, string src)
 
static Pointer< sbyte > Qstrdup (string arg1)
 
static int Qstricmp (string arg1, string arg2)
 
static uint Qstrlen (string str)
 
static int Qstrncmp (string str1, string str2, uint len)
 
static Pointer< sbyte > Qstrncpy (Pointer< sbyte > dst, string src, uint len)
 
static int Qstrnicmp (string arg1, string arg2, uint len)
 
static uint Qstrnlen (string str, uint maxlen)
 
static string QtTrId (string id, int n=-1)
 

Protected Member Functions

 QApplication (System.Type dummy)
 
new void OnCommitDataRequest (QSessionManager sessionManager)
 
 
new void OnFocusChanged (QWidget old, QWidget now)
 
 
new void OnFontDatabaseChanged ()
 
 
new void OnLastWindowClosed ()
 
 
new void OnSaveStateRequest (QSessionManager sessionManager)
 
 
- Protected Member Functions inherited from QtCore.QCoreApplication
 QCoreApplication (System.Type dummy)
 
new void OnAboutToQuit ()
 
 
new void OnUnixSignal (int arg1)
 
- Protected Member Functions inherited from QtCore.QObject
 QObject (System.Type dummy)
 
virtual void OnChildEvent (QChildEvent arg1)
 
 
virtual void ConnectNotify (string signal)
 
 
virtual void OnCustomEvent (QEvent arg1)
 
 
new void OnDestroyed (QObject arg1=null)
 
 
virtual void DisconnectNotify (string signal)
 
 
new int Receivers (string signal)
 
 
new QObject Sender ()
 
 
new int SenderSignalIndex ()
 
 
virtual void OnTimerEvent (QTimerEvent arg1)
 
 

Properties

Slot LastWindowClosed
 
 
Slot< QWidget, QWidgetFocusChanged
 
 
Slot FontDatabaseChanged
 
 
Slot< QSessionManagerCommitDataRequest
 
 
Slot< QSessionManagerSaveStateRequest
 
 
static QWidget ActiveWindow [get, set]
 
 
static int colorSpec [get, set]
 
 
static bool DesktopSettingsAware [get, set]
 
 
new QInputContext InputContext [get, set]
 
 
static QCursor OverrideCursor [get, set]
 
 
static QStyle Style [get, set]
 
 
new Qt.LayoutDirection LayoutDirection [get, set]
 
 
new QIcon WindowIcon [get, set]
 
 
new int CursorFlashTime [get, set]
 
 
new int DoubleClickInterval [get, set]
 
 
new int KeyboardInputInterval [get, set]
 
 
new int WheelScrollLines [get, set]
 
 
new QSize GlobalStrut [get, set]
 
 
new int StartDragTime [get, set]
 
 
new int StartDragDistance [get, set]
 
new bool QuitOnLastWindowClosed [get, set]
 
 
new string StyleSheet [get, set]
 
 
new bool AutoSipEnabled [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
new IQApplicationSignals Emit [get]
 
- Properties inherited from QtCore.QCoreApplication
Slot AboutToQuit
 
 
Slot< System.Int32 > UnixSignal
 
static
System.Collections.Generic.List
< string > 
LibraryPaths [get, set]
 
 
new string ApplicationName [get, set]
 
 
new string ApplicationVersion [get, set]
 
 
new string OrganizationName [get, set]
 
 
new string OrganizationDomain [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
new IQCoreApplicationSignals Emit [get]
 
- Properties inherited from QtCore.QObject
virtual EventHandler
< QEventArgs< QChildEvent > > 
ChildEvent
 
 
virtual EventHandler
< QEventArgs< QEvent > > 
CustomEvent
 
 
virtual EventHandler
< QEventArgs< QEvent > > 
Event
 
 
virtual EventHandler
< QEventArgs< QTimerEvent > > 
TimerEvent
 
 
Slot< QObjectDestroyedQObject
 
Slot Destroyed
 
 
new QObject Parent [get, set]
 
 
virtual System.IntPtr SmokeObject [get, set]
 
new string ObjectName [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
 
static new QMetaObject StaticQtMetaObject [get]
 
new IQObjectSignals Emit [get]
 

Additional Inherited Members

- Protected Attributes inherited from QtCore.QObject
object Q_EMIT = null
 
SmokeInvocation interceptor
 
readonly List< QEventHandler > eventFilters = new List<QEventHandler>()
 

Detailed Description

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().

It provides support for sophisticated session management. This makes it possible for applications to terminate gracefully when the user logs out, to cancel a shutdown process if termination isn't possible and even to preserve the entire application's state for a future session. See isSessionRestored(), sessionId() and commitData() and saveState() for details.

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.

Groups of functions

System settings desktopSettingsAware(), setDesktopSettingsAware(), cursorFlashTime(), setCursorFlashTime(), doubleClickInterval(), setDoubleClickInterval(), setKeyboardInputInterval(), wheelScrollLines(), setWheelScrollLines(), palette(), setPalette(), font(), setFont(), fontMetrics().

Event handling exec(), processEvents(), exit(), quit(). sendEvent(), postEvent(), sendPostedEvents(), removePostedEvents(), hasPendingEvents(), notify(), macEventFilter(), qwsEventFilter(), x11EventFilter(), x11ProcessEvent(), winEventFilter().

GUI Styles style(), setStyle().

Color usage colorSpec(), setColorSpec(), qwsSetCustomColors().

Text handling installTranslator(), removeTranslator() translate().

Widgets allWidgets(), topLevelWidgets(), desktop(), activePopupWidget(), activeModalWidget(), clipboard(), focusWidget(), activeWindow(), widgetAt().

Advanced cursor handling overrideCursor(), setOverrideCursor(), restoreOverrideCursor().

X Window System synchronization flushX(), syncX().

Session management isSessionRestored(), sessionId(), commitData(), saveState().

Miscellaneous closeAllWindows(), startingUp(), closingDown(), type().

See also QCoreApplication, QAbstractEventDispatcher, QEventLoop, and QSettings.

Member Enumeration Documentation

See setColorSpec() for full details.

Enumerator:
CustomColor 

The same as NormalColor for X11; allocates colors to a palette on demand under Windows

ManyColor 

The right choice for applications that use thousands of colors

NormalColor 

The default color allocation policy

Enumerator:
GuiClient 

A GUI client application

GuiServer 

A GUI server application (for Qt for Embedded Linux)

Tty 

A console application

Constructor & Destructor Documentation

QtGui.QApplication.QApplication ( System.Type  dummy)
protected

Member Function Documentation

static void QtGui.QApplication.AboutQt ( )
static

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().

static QWidget QtGui.QApplication.ActiveModalWidget ( )
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.

See also activePopupWidget() and topLevelWidgets().

static QWidget QtGui.QApplication.ActivePopupWidget ( )
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.

See also activeModalWidget() and topLevelWidgets().

static void QtGui.QApplication.Alert ( QWidget  widget,
int  duration = 0 
)
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.

This function was introduced in Qt 4.3.

static System.Collections.Generic.List<QWidget> QtGui.QApplication.AllWidgets ( )
static

Returns a list of all the widgets in the application.

The list is empty (QList::isEmpty()) if there are no widgets.

Note: Some of the widgets may be hidden.

Example:

void updateAllWidgets()

{

foreach (QWidget *widget, QApplication::allWidgets())

widget->update();

}

See also topLevelWidgets() and QWidget::isVisible().

static void QtGui.QApplication.Beep ( )
static

Sounds the bell, using the default volume and sound. The function is not available in Qt for Embedded Linux.

static void QtGui.QApplication.ChangeOverrideCursor ( QCursor  arg1)
static

Changes the currently active application override cursor to cursor.

This function has no effect if setOverrideCursor() was not called.

See also setOverrideCursor(), overrideCursor(), restoreOverrideCursor(), and QWidget::setCursor().

static QClipboard QtGui.QApplication.Clipboard ( )
static

Returns a pointer to the application global clipboard.

Note: The QApplication object should already be constructed before accessing the clipboard.

static void QtGui.QApplication.CloseAllWindows ( )
static

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:

exitAct = new QAction(tr("E&xit"), this);

exitAct->setShortcuts(QKeySequence::Quit);

exitAct->setStatusTip(tr("Exit the application"));

connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));

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.

See also quitOnLastWindowClosed, lastWindowClosed(), QWidget::close(), QWidget::closeEvent(), lastWindowClosed(), quit(), topLevelWidgets(), and QWidget::isWindow().

virtual void QtGui.QApplication.CommitData ( QSessionManager  sm)
virtual

This function deals with 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.

Warning: Within this function, no user interaction is possible, unless you ask the manager for explicit permission. See QSessionManager::allowsInteraction() and QSessionManager::allowsErrorInteraction() for details and example usage.

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.

See also isSessionRestored(), sessionId(), saveState(), and Session Management.

override void QtGui.QApplication.CreateProxy ( )
virtual

Reimplemented from QtCore.QCoreApplication.

static QDesktopWidget QtGui.QApplication.Desktop ( )
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.

new void QtGui.QApplication.Dispose ( )
static QWidget QtGui.QApplication.FocusWidget ( )
static

Returns the application widget that has the keyboard input focus, or 0 if no widget in this application has the focus.

See also QWidget::setFocus(), QWidget::hasFocus(), activeWindow(), and focusChanged().

static QFont QtGui.QApplication.Font ( )
static

Returns the default application font.

See also setFont(), fontMetrics(), and QWidget::font().

static QFont QtGui.QApplication.Font ( QWidget  arg1)
static

This is an overloaded function.

Returns the default font for the widget.

See also fontMetrics() and QWidget::setFont().

static QFont QtGui.QApplication.Font ( string  className)
static

This is an overloaded function.

Returns the font for widgets of the given className.

See also setFont() and QWidget::font().

static QFontMetrics QtGui.QApplication.FontMetrics ( )
static

Returns display (screen) font metrics for the application font.

See also font(), setFont(), QWidget::fontMetrics(), and QPainter::fontMetrics().

static bool QtGui.QApplication.IsEffectEnabled ( Qt.UIEffect  arg1)
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).

Note: All effects are disabled on screens running at less than 16-bit color depth.

See also setEffectEnabled() and Qt::UIEffect.

static bool QtGui.QApplication.IsLeftToRight ( )
static

Returns true if the application's layout direction is Qt::LeftToRight; otherwise returns false.

See also layoutDirection() and isRightToLeft().

static bool QtGui.QApplication.IsRightToLeft ( )
static

Returns true if the application's layout direction is Qt::RightToLeft; otherwise returns false.

See also layoutDirection() and isLeftToRight().

new bool QtGui.QApplication.IsSessionRestored ( )

Returns true if the application has been restored from an earlier session; otherwise returns false.

See also sessionId(), commitData(), and saveState().

static Qt.LayoutDirection QtGui.QApplication.KeyboardInputDirection ( )
static

Returns the current keyboard input direction.

This function was introduced in Qt 4.2.

static QLocale QtGui.QApplication.KeyboardInputLocale ( )
static

Returns the current keyboard input locale.

This function was introduced in Qt 4.2.

static Qt.KeyboardModifier QtGui.QApplication.KeyboardModifiers ( )
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.

See also mouseButtons() and queryKeyboardModifiers().

static Qt.MouseButton QtGui.QApplication.MouseButtons ( )
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.

See also keyboardModifiers().

override bool QtGui.QApplication.Notify ( QObject  arg1,
QEvent  arg2 
)
virtual

Reimplemented from QCoreApplication::notify().

Reimplemented from QtCore.QCoreApplication.

new void QtGui.QApplication.OnCommitDataRequest ( QSessionManager  sessionManager)
protected

This signal deals with 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.

Warning: Within this signal, no user interaction is possible, unless you ask the manager for explicit permission. See QSessionManager::allowsInteraction() and QSessionManager::allowsErrorInteraction() for details and example usage.

Note: You should use Qt::DirectConnection when connecting to this signal.

This function was introduced in Qt 4.2.

See also isSessionRestored(), sessionId(), saveState(), and Session Management.

override bool QtGui.QApplication.OnEvent ( QEvent  arg1)
virtual

Reimplemented from QObject::event().

Reimplemented from QtCore.QCoreApplication.

new void QtGui.QApplication.OnFocusChanged ( QWidget  old,
QWidget  now 
)
protected

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.

This function was introduced in Qt 4.1.

See also QWidget::setFocus(), QWidget::clearFocus(), and Qt::FocusReason.

new void QtGui.QApplication.OnFontDatabaseChanged ( )
protected

This signal is emitted when application fonts are loaded or removed.

This function was introduced in Qt 4.5.

See also QFontDatabase::addApplicationFont(), QFontDatabase::addApplicationFontFromData(), QFontDatabase::removeAllApplicationFonts(), and QFontDatabase::removeApplicationFont().

new void QtGui.QApplication.OnLastWindowClosed ( )
protected

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

QApplication implicitly quits when this signal is emitted.

This feature can be turned off by setting quitOnLastWindowClosed to false.

See also QWidget::close().

new void QtGui.QApplication.OnSaveStateRequest ( QSessionManager  sessionManager)
protected

This signal deals with 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.

Warning: Within this function, no user interaction is possible, unless you ask the manager for explicit permission. See QSessionManager::allowsInteraction() and QSessionManager::allowsErrorInteraction() for details.

Note: You should use Qt::DirectConnection when connecting to this signal.

This function was introduced in Qt 4.2.

See also isSessionRestored(), sessionId(), commitData(), and Session Management.

static QPalette QtGui.QApplication.Palette ( )
static

Returns the application palette.

See also setPalette() and QWidget::palette().

static QPalette QtGui.QApplication.Palette ( QWidget  arg1)
static

This is an overloaded function.

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.

See also setPalette() and QWidget::palette().

static QPalette QtGui.QApplication.Palette ( string  className)
static

This is an overloaded function.

Returns the palette for widgets of the given className.

See also setPalette() and QWidget::palette().

static Qt.KeyboardModifier QtGui.QApplication.QueryKeyboardModifiers ( )
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.

This function was introduced in Qt 4.8.

See also keyboardModifiers().

static void QtGui.QApplication.RestoreOverrideCursor ( )
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.

See also setOverrideCursor() and overrideCursor().

virtual void QtGui.QApplication.SaveState ( QSessionManager  sm)
virtual

This function deals with 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.

Warning: Within this function, no user interaction is possible, unless you ask the manager for explicit permission. See QSessionManager::allowsInteraction() and QSessionManager::allowsErrorInteraction() for details.

See also isSessionRestored(), sessionId(), commitData(), and Session Management.

new string QtGui.QApplication.SessionId ( )

Returns the current 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.

See also isSessionRestored(), sessionKey(), commitData(), and saveState().

new string QtGui.QApplication.SessionKey ( )

Returns the session key in the current 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().

See also isSessionRestored(), sessionId(), commitData(), and saveState().

static void QtGui.QApplication.SetEffectEnabled ( Qt.UIEffect  arg1,
bool  enable = true 
)
static

Enables the UI effect effect if enable is true, otherwise the effect will not be used.

Note: All effects are disabled on screens running at less than 16-bit color depth.

See also isEffectEnabled(), Qt::UIEffect, and setDesktopSettingsAware().

static void QtGui.QApplication.SetFont ( QFont  arg1,
string  className = null 
)
static

Changes the default application font to font. 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.

Warning: Do not use this function in conjunction with Qt Style Sheets. The font of an application can be customized using the "font" style sheet property. To set a bold font for all QPushButtons, set the application styleSheet() as "QPushButton { font: bold }"

See also font(), fontMetrics(), and QWidget::setFont().

static void QtGui.QApplication.SetGraphicsSystem ( string  arg1)
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:

the application commandline -graphicssystem switch

QApplication::setGraphicsSystem()

the QT_GRAPHICSSYSTEM environment variable

the Qt configure -graphicssystem switch

If the highest precedence switch sets an invalid name, the error will be ignored and the default backend will be used.

Warning: This function is only effective before the QApplication constructor is called.

Note: The "opengl" option is currently experimental.

This function was introduced in Qt 4.5.

static void QtGui.QApplication.SetPalette ( QPalette  arg1,
string  className = null 
)
static

Changes the default application palette to palette.

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().

Warning: Do not use this function in conjunction with Qt Style Sheets. When using style sheets, the palette of a widget can be customized using the "color", "background-color", "selection-color", "selection-background-color" and "alternate-background-color".

Note: Some styles do not use the palette for all drawing, for instance, if they make use of native theme engines. This is the case for the Windows XP, Windows Vista, and Mac OS X styles.

See also QWidget::setPalette(), palette(), and QStyle::polish().

static QStyle QtGui.QApplication.SetStyle ( string  arg1)
static

This is an overloaded function.

Requests a QStyle object for style from the QStyleFactory.

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.

Warning: To ensure that the application's style is set correctly, it is best to call this function before the QApplication constructor, if possible.

static void QtGui.QApplication.SyncX ( )
static

Synchronizes with the X server in the X11 implementation. This normally takes some time. Does nothing on other platforms.

static QWidget QtGui.QApplication.TopLevelAt ( QPoint  p)
static

Returns the top-level widget at the given point; returns 0 if there is no such widget.

static QWidget QtGui.QApplication.TopLevelAt ( int  x,
int  y 
)
static

This is an overloaded function.

Returns the top-level widget at the point (x, y); returns 0 if there is no such widget.

static System.Collections.Generic.List<QWidget> QtGui.QApplication.TopLevelWidgets ( )
static

Returns a list of the top-level widgets (windows) in the application.

Note: Some of the top-level widgets may be hidden, for example a tooltip if no tooltip is currently shown.

Example:

void showAllHiddenTopLevelWidgets()

{

foreach (QWidget *widget, QApplication::topLevelWidgets()) {

if (widget->isHidden())

widget->show();

}

}

See also allWidgets(), QWidget::isWindow(), and QWidget::isHidden().

static string QtGui.QApplication.Tr ( string  s,
string  c = null 
)
static
static string QtGui.QApplication.Tr ( string  s,
string  c,
int  n 
)
static
static string QtGui.QApplication.TrUtf8 ( string  s,
string  c = null 
)
static
static string QtGui.QApplication.TrUtf8 ( string  s,
string  c,
int  n 
)
static
static QApplication.Type QtGui.QApplication.type ( )
static

Returns the type of application (Tty, GuiClient, or GuiServer). The type is set when constructing the QApplication object.

static QWidget QtGui.QApplication.WidgetAt ( QPoint  p)
static

Returns the widget at global screen position point, or 0 if there is no Qt widget there.

This function can be slow.

See also QCursor::pos(), QWidget::grabMouse(), and QWidget::grabKeyboard().

static QWidget QtGui.QApplication.WidgetAt ( int  x,
int  y 
)
static

This is an overloaded function.

Returns the widget at global screen position (x, y), or 0 if there is no Qt widget there.

new void QtGui.QApplication.WinFocus ( QWidget  arg1,
bool  arg2 
)
static void QtGui.QApplication.WinMouseButtonUp ( )
static

Property Documentation

QWidget QtGui.QApplication.ActiveWindow
staticgetset

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.

Sets the active window to the active widget in response to a system event. The function is called from the platform specific event handlers.

Warning: This function does not set the keyboard focus to the active widget. Call QWidget::activateWindow() instead.

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.

new bool QtGui.QApplication.AutoSipEnabled
getset

This property holds 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.

This property was introduced in Qt 4.5.

int QtGui.QApplication.colorSpec
staticgetset

Returns the color specification.

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::NormalColor. This is the default color allocation strategy. Use this option if your application uses buttons, menus, texts and pixmaps with few colors. With this option, the application uses system global colors. This works fine for most applications under X11, but on the Windows platform, it may cause dithering of non-standard colors.

QApplication::CustomColor. Use this option if your application needs a small number of custom colors. On X11, this option is the same as NormalColor. On Windows, Qt creates a Windows palette, and allocates colors to it on demand.

QApplication::ManyColor. Use this option if your application is very color hungry, e.g., it requires thousands of colors. Under X11 the effect is:

For 256-color displays which have at best a 256 color true color visual, the default visual is used, and colors are allocated from a color cube. The color cube is the 6x6x6 (216 color) "Web palette" (the red, green, and blue components always have one of the following values: 0x00, 0x33, 0x66, 0x99, 0xCC, or 0xFF), but the number of colors can be changed by the -ncols option. The user can force the application to use the true color visual with the -visual option.

For 256-color displays which have a true color visual with more than 256 colors, use that visual. Silicon Graphics X servers this feature, for example. They provide an 8 bit visual by default but can deliver true color when asked.

On Windows, Qt creates a Windows palette, and fills it with a color cube.

Slot<QSessionManager> QtGui.QApplication.CommitDataRequest
addremove

This signal deals with 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.

Warning: Within this signal, no user interaction is possible, unless you ask the manager for explicit permission. See QSessionManager::allowsInteraction() and QSessionManager::allowsErrorInteraction() for details and example usage.

Note: You should use Qt::DirectConnection when connecting to this signal.

This function was introduced in Qt 4.2.

See also isSessionRestored(), sessionId(), saveState(), and Session Management.

new int QtGui.QApplication.CursorFlashTime
getset

This property holds 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.

bool QtGui.QApplication.DesktopSettingsAware
staticgetset

Returns true if Qt is set to use the system's standard colors, fonts, etc.; otherwise returns false. The default is true.

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:

int main(int argc, char *argv[])

{

QApplication::setDesktopSettingsAware(false);

QApplication app(argc, argv);

...

return app.exec();

}

new int QtGui.QApplication.DoubleClickInterval
getset

This property holds 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.

new IQApplicationSignals QtGui.QApplication.Emit
getprotected
Slot<QWidget,QWidget> QtGui.QApplication.FocusChanged
addremove

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.

This function was introduced in Qt 4.1.

See also QWidget::setFocus(), QWidget::clearFocus(), and Qt::FocusReason.

Slot QtGui.QApplication.FontDatabaseChanged
addremove

This signal is emitted when application fonts are loaded or removed.

This function was introduced in Qt 4.5.

See also QFontDatabase::addApplicationFont(), QFontDatabase::addApplicationFontFromData(), QFontDatabase::removeAllApplicationFonts(), and QFontDatabase::removeApplicationFont().

new QSize QtGui.QApplication.GlobalStrut
getset

This property holds 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:

QSize MyWidget::sizeHint() const

{

return QSize(80, 25).expandedTo(QApplication::globalStrut());

}

By default, this property contains a QSize object with zero width and height.

new QInputContext QtGui.QApplication.InputContext
getset

Returns the QInputContext instance used by the application.

This function replaces the QInputContext instance used by the application with inputContext.

Qt takes ownership of the given inputContext.

new int QtGui.QApplication.KeyboardInputInterval
getset

This property holds 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.

This property was introduced in Qt 4.2.

Slot QtGui.QApplication.LastWindowClosed
addremove

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

QApplication implicitly quits when this signal is emitted.

This feature can be turned off by setting quitOnLastWindowClosed to false.

See also QWidget::close().

new Qt.LayoutDirection QtGui.QApplication.LayoutDirection
getset

This property holds the default layout direction for this application.

On system start-up, the default layout direction depends on the application's language.

QCursor QtGui.QApplication.OverrideCursor
staticgetset

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).

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:

QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));

calculateHugeMandelbrot(); // lunch time...

QApplication::restoreOverrideCursor();

new bool QtGui.QApplication.QuitOnLastWindowClosed
getset

This property holds 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.

Slot<QSessionManager> QtGui.QApplication.SaveStateRequest
addremove

This signal deals with 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.

Warning: Within this function, no user interaction is possible, unless you ask the manager for explicit permission. See QSessionManager::allowsInteraction() and QSessionManager::allowsErrorInteraction() for details.

Note: You should use Qt::DirectConnection when connecting to this signal.

This function was introduced in Qt 4.2.

See also isSessionRestored(), sessionId(), commitData(), and Session Management.

new int QtGui.QApplication.StartDragDistance
getset
new int QtGui.QApplication.StartDragTime
getset

This property holds 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.

new QMetaObject QtGui.QApplication.StaticMetaObject
staticget
QStyle QtGui.QApplication.Style
staticgetset

Returns the application's style object.

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:

QApplication::setStyle(new QWindowsStyle);

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.

Warning: Qt style sheets are currently not supported for custom QStyle subclasses. We plan to address this in some future release.

new string QtGui.QApplication.StyleSheet
getset

This property holds 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.

This property was introduced in Qt 4.2.

new int QtGui.QApplication.WheelScrollLines
getset

This property holds 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.

new QIcon QtGui.QApplication.WindowIcon
getset

This property holds the default window icon.