CopperSpice API  1.9.1
QApplication Class Reference

Manages the control flow and main settings of a GUI application. More...

Inheritance diagram for QApplication:
QCoreApplication QObject

Public Typedefs

using FP_Void = void (*)()
 

Public Types

enum  ColorSpec
 

Public Signals

void applicationStateChanged (Qt::ApplicationState state)
 
void commitDataRequest (QSessionManager *sessionManager)
 
void focusChanged (QWidget *old, QWidget *current)
 
void focusObjectChanged (QObject *focusObject)
 
void focusWindowChanged (QWindow *focusWindow)
 
void fontDatabaseChanged ()
 
void lastWindowClosed ()
 
void layoutDirectionChanged (Qt::LayoutDirection direction)
 
void paletteChanged (const QPalette &palette)
 
void primaryScreenChanged (QScreen *screen)
 
void saveStateRequest (QSessionManager *sessionManager)
 
void screenAdded (QScreen *screen)
 
void screenRemoved (QScreen *screen)
 
- Public Signals inherited from QCoreApplication
void aboutToQuit ()
 
void unixSignal (int signalId)
 
- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 

Public Slots

static void aboutCs ()
 
bool autoSipEnabled ()
 
static void closeAllWindows ()
 
void setAutoSipEnabled (const bool enabled)
 
void setStyleSheet (const QString &sheet)
 
- Public Slots inherited from QCoreApplication
static void quit ()
 
- Public Slots inherited from QObject
void deleteLater ()
 

Public Methods

 QApplication (int &argc, char **argv, int flags=ApplicationFlags)
 
virtual ~QApplication ()
 
qreal devicePixelRatio () const
 
bool isSavingSession () const
 
bool isSessionRestored () const
 
bool notify (QObject *receiver, QEvent *event) override
 
QString sessionId () const
 
QString sessionKey () const
 
QString styleSheet () const
 
- Public Methods inherited from QCoreApplication
 QCoreApplication (int &argc, char **argv)
 
 ~QCoreApplication ()
 
void installNativeEventFilter (QAbstractNativeEventFilter *filterObj)
 
void removeNativeEventFilter (QAbstractNativeEventFilter *filterObj)
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 

Static Public Methods

static QWidgetactiveModalWidget ()
 
static QWidgetactivePopupWidget ()
 
static QWidgetactiveWindow ()
 
static void alert (QWidget *widget, int duration=0)
 
static QWidgetList allWidgets ()
 
static QWindowList allWindows ()
 
static QString applicationDisplayName ()
 
static Qt::ApplicationState applicationState ()
 
static void beep ()
 
static void changeOverrideCursor (const QCursor &cursor)
 
static QClipboardclipboard ()
 
static int colorSpec ()
 
static int cursorFlashTime ()
 
static QDesktopWidgetdesktop ()
 
static bool desktopSettingsAware ()
 
static int doubleClickInterval ()
 
static int exec ()
 
static QObjectfocusObject ()
 
static QWidgetfocusWidget ()
 
static QWindowfocusWindow ()
 
static QFont font ()
 
static QFont font (const QString &className)
 
static QFont font (const QWidget *widget)
 
static QFontMetrics fontMetrics ()
 
static QSize globalStrut ()
 
static QInputMethodinputMethod ()
 
static bool isEffectEnabled (Qt::UIEffect effect)
 
static bool isFallbackSessionManagementEnabled ()
 
static bool isLeftToRight ()
 
static bool isRightToLeft ()
 
static int keyboardInputInterval ()
 
static Qt::KeyboardModifiers keyboardModifiers ()
 
static Qt::LayoutDirection layoutDirection ()
 
static QWindowmodalWindow ()
 
static Qt::MouseButtons mouseButtons ()
 
static QCursoroverrideCursor ()
 
static QPalette palette ()
 
static QPalette palette (const QString &className)
 
static QPalette palette (const QWidget *widget)
 
static FP_Void platformFunction (const QByteArray &function)
 
static QString platformName ()
 
static QPlatformNativeInterfaceplatformNativeInterface ()
 
static QScreenprimaryScreen ()
 
static Qt::KeyboardModifiers queryKeyboardModifiers ()
 
static bool quitOnLastWindowClosed ()
 
static void restoreOverrideCursor ()
 
static QList< QScreen * > screens ()
 
static void setActiveWindow (QWidget *active)
 
static void setApplicationDisplayName (const QString &name)
 
static void setColorSpec (int spec)
 
static void setCursorFlashTime (int duration)
 
static void setDesktopSettingsAware (bool on)
 
static void setDoubleClickInterval (int interval)
 
static void setEffectEnabled (Qt::UIEffect effect, bool enable=true)
 
static void setFallbackSessionManagementEnabled (bool enable)
 
static void setFont (const QFont &font, const QString &className=QString ())
 
static void setGlobalStrut (const QSize &size)
 
static void setKeyboardInputInterval (int interval)
 
static void setLayoutDirection (Qt::LayoutDirection direction)
 
static void setOverrideCursor (const QCursor &cursor)
 
static void setPalette (const QPalette &palette, const QString &className=QString ())
 
static void setQuitOnLastWindowClosed (bool quit)
 
static void setStartDragDistance (int distance)
 
static void setStartDragTime (int time)
 
static QStylesetStyle (const QString &style)
 
static void setStyle (QStyle *style)
 
static void setWheelScrollLines (int lines)
 
static void setWindowIcon (const QIcon &icon)
 
static int startDragDistance ()
 
static int startDragTime ()
 
static QStylestyle ()
 
static QStyleHintsstyleHints ()
 
static void sync ()
 
static QWidgettopLevelWidgetAt (const QPoint &pos)
 
static QWidgetList topLevelWidgets ()
 
static QWindowtopLevelWindowAt (const QPoint &pos)
 
static QWindowList topLevelWindows ()
 
static int wheelScrollLines ()
 
static QWidgetwidgetAt (const QPoint &point)
 
static QWidgetwidgetAt (int x, int y)
 
static QIcon windowIcon ()
 
- Static Public Methods inherited from QCoreApplication
static void addLibraryPath (const QString &path)
 
static QString applicationDirPath ()
 
static QString applicationFilePath ()
 
static QString applicationName ()
 
static qint64 applicationPid ()
 
static QString applicationVersion ()
 
static QStringList arguments ()
 
static bool closingDown ()
 
static int exec ()
 
static void exit (int returnCode=0)
 
static void flush ()
 
static void installTranslator (QTranslator *translationFile)
 
static QCoreApplication * instance ()
 
static bool isQuitLockEnabled ()
 
static bool isSetuidAllowed ()
 
static QStringList libraryPaths ()
 
static QString organizationDomain ()
 
static QString organizationName ()
 
static void postEvent (QObject *receiver, QEvent *event, int priority=Qt::NormalEventPriority)
 
static void processEvents (QEventLoop::ProcessEventsFlags flags, int maxtime)
 
static void processEvents (QEventLoop::ProcessEventsFlags flags=QEventLoop::AllEvents)
 
static void removeLibraryPath (const QString &path)
 
static void removePostedEvents (QObject *receiver, int eventType=0)
 
static void removeTranslator (QTranslator *translationFile)
 
static bool sendEvent (QObject *receiver, QEvent *event)
 
static void sendPostedEvents (QObject *receiver=nullptr, int event_type=0)
 
static void setApplicationName (const QString &application)
 
static void setApplicationVersion (const QString &version)
 
static void setAttribute (Qt::ApplicationAttribute attribute, bool on=true)
 
static void setLibraryPaths (const QStringList &paths)
 
static void setOrganizationDomain (const QString &orgDomain)
 
static void setOrganizationName (const QString &orgName)
 
static void setQuitLockEnabled (bool enabled)
 
static void setSetuidAllowed (bool allow)
 
static bool startingUp ()
 
static bool testAttribute (Qt::ApplicationAttribute attribute)
 
static QString translate (const char *context, const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 
static QString translate (const QString &context, const QString &text, const QString &comment=QString (), std::optional< int > numArg=std::optional< int >())
 
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 

Protected Methods

bool event (QEvent *event) override
 
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Properties

 applicationDisplayName
 
 autoSipEnabled
 
 cursorFlashTime
 
 doubleClickInterval
 
 globalStrut
 
 keyboardInputInterval
 
 layoutDirection
 
 platformName
 
 primaryScreen
 
 quitOnLastWindowClosed
 
 startDragDistance
 
 startDragTime
 
 styleSheet
 
 wheelScrollLines
 
 windowIcon
 
- Properties inherited from QCoreApplication
 applicationName
 
 applicationVersion
 
 organizationDomain
 
 organizationName
 
 quitLockEnabled
 
- Properties inherited from QObject
 objectName
 

Friends

class QAction
 
class QGraphicsItem
 
class QGraphicsScene
 
class QGraphicsWidget
 
class QLineEdit
 
class QPlatformIntegration
 
class QPlatformSessionManager
 
class QShortcut
 
class QTranslator
 
class QWidget
 

Additional Inherited Members

Detailed Description

The QApplication class manages the control flow and main settings of a GUI application. 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.

For any CopperSpice GUI application there is precisely one QApplication object, no matter how many windows are open at any given time. For non-GUI CopperSpice applications use QCoreApplication since it does not depend on the CsGui library.

The QApplication object is accessible through the QApplication::instance() method which returns a pointer to this object. The global qApp pointer is equivalent to calling this instance() method.

Class Overview

The following is a summary of the key functionality for this class.

  • Initialize the application with the user's desktop settings such as palette(), font() and doubleClickInterval().
  • Keeps track of properties when the use changes the desktop globally, for example through the operating system control panel.
  • Performs event handling to receive events from the underlying window system and dispatch to the corresponding widgets. Use sendEvent() and postEvent().
  • Parses command line arguments during initialization, refer to constructor methods for more information.
  • Defines the application's look and feel, which is encapsulated in a QStyle object. This can be changed at runtime with setStyle().
  • Specifies how the application uses colors, refer to setColorSpec() for more details.
  • Provides localization of strings that are visible to the user via translate().
  • Provides global objects like desktop() and clipboard().
  • Tracks the windows and widgets in a an application, refer to widgetAt(), topLevelWidgets() and closeAllWindows(), etc.
  • Manages the application's mouse cursor handling, refer to setOverrideCursor()

Functionality Overview

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

CategoriesGroups of Methods
System settingsdesktopSettingsAware(), setDesktopSettingsAware(), cursorFlashTime(), setCursorFlashTime(), doubleClickInterval(), setDoubleClickInterval(), setKeyboardInputInterval(), wheelScrollLines(), setWheelScrollLines(), palette(), setPalette(), font(), setFont(), fontMetrics()
Event handlingexec(), exit(), quit(), processEvents(), postEvent(), sendEvent(), sendPostedEvents(), removePostedEvents(), notify()
GUI Stylesstyle(), setStyle()
Color usagecolorSpec(), setColorSpec()
Text handlinginstallTranslator(), removeTranslator() translate()
WidgetsallWidgets(), topLevelWidgets(), desktop(), activePopupWidget(), activeModalWidget(), clipboard(), focusWidget(), activeWindow(), widgetAt()
Cursor handlingoverrideCursor(), setOverrideCursor(), restoreOverrideCursor()
MiscellaneouscloseAllWindows(), startingUp(), closingDown()
See also
QCoreApplication, QAbstractEventDispatcher, QEventLoop, QSettings

Member Typedef Documentation

Typedef for a function pointer with no arguments which returns void.

Member Enumeration Documentation

ConstantValueDescription
QApplication::NormalColor0 the default color allocation policy
QApplication::CustomColor1 the same as NormalColor for X11; allocates colors to a palette on demand under Windows
QApplication::ManyColor2 the right choice for applications that use thousands of colors

Refer to setColorSpec() for full details.

Constructor & Destructor Documentation

QApplication::QApplication ( int &  argc,
char **  argv,
int  flags = ApplicationFlags 
)

Initializes the window system and constructs an application object with argc command line arguments in argv. The data referred to by argc and argv must remain valid for the entire lifetime of the QApplication object. In addition, argc must be greater than zero and argv must contain at least one valid character string.

Only one application object should be created for a given program. The application object must be constructed before any paint devices are constructed. The global qApp pointer refers to this application object.

QApplication automatically supports the following command line options.

-style= style
Sets the application GUI style. Possible values depend on your platform configuration. If CopperSpice was compiled with additional styles or has additional styles as plugins these will be usable for this command line option.
-style style
Same as listed above.
-stylesheet= stylesheet
Sets the application style sheet. The value must be a path to a file that contains the style sheet. Relative URLs in the style sheet file are relative to the Style Sheet file's path.
-stylesheet stylesheet
Same as listed above.
-widgetcount
Prints debug message at the end about number of widgets left undestroyed and maximum number of widgets existed at the same time
-reverse
Sets the application's layout direction to Qt::RightToLeft
See also
arguments()
QApplication::~QApplication ( )
virtual

Cleans up any window system resources that were allocated by this application. Sets the global variable qApp to nullptr.

Method Documentation

void QApplication::aboutCs ( )
slot

Displays a simple message box about CopperSpice. The message includes the version number of CopperSpice being used by the application. This is useful for inclusion in the Help menu of your application.

This method is a convenience slot for QMessageBox::aboutCs().

QWidget * QApplication::activeModalWidget ( )
static

Returns the active modal widget. Modal widgets are organized in a stack.

A modal widget is a special top-level widget which inherits from QDialog. A modal widget must be closed before the user can continue with other parts of the program.

See also
activePopupWidget(), topLevelWidgets()
QWidget * QApplication::activePopupWidget ( )
static

Returns the active popup widget. Popup widgets are organized in a stack.

A popup widget is a special top-level widget with the Qt::WType_Popup flag enabled. When the application opens a popup widget all events are sent to this widget. Other widgets and modal widgets can not be accessed before the popup widget is closed.

Only other popup widgets may be opened while the current popup widget is active.

See also
activeModalWidget(), topLevelWidgets()
QWidget * QApplication::activeWindow ( )
static

Returns the application top level window which has the keyboard input focus or a nullptr if no application window has focus. There might be an activeWindow() even if there is no focusWidget(), for example if no widget in that window accepts key events.

See also
setActiveWindow(), QWidget::setFocus(), QWidget::hasFocus(), focusWidget()
void 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 duration in milliseconds. If duration is zero then the alert is shown indefinitely until the window becomes active again.

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

QWidgetList 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.
void updateAllWidgets() {
for (QWidget *widget : QApplication::allWidgets()) {
widget->update();
}
}
See also
topLevelWidgets(), QWidget::isVisible()
QWindowList QApplication::allWindows ( )
static

Returns a list of all the windows in the application. The list is empty if there are no windows.

See also
topLevelWindows()
QString QApplication::applicationDisplayName ( )
static

Returns the value of the property applicationDisplayName.

Qt::ApplicationState QApplication::applicationState ( )
static

Returns the value of the property applicationState.

void QApplication::applicationStateChanged ( Qt::ApplicationState  state)
signal

This signal is emitted when the state of the application changes.

See also
applicationState()
bool QApplication::autoSipEnabled ( )
slot

Returns the value of the property autoSipEnabled.

void QApplication::beep ( )
static

Sounds the bell using the default volume and sound.

void QApplication::changeOverrideCursor ( const QCursor cursor)
static

Changes the currently active application override cursor to cursor. This method has no effect if setOverrideCursor() was not called.

See also
setOverrideCursor(), overrideCursor(), restoreOverrideCursor(), QWidget::setCursor()
QClipboard * QApplication::clipboard ( )
static

Returns a pointer to the application global clipboard.

Note
The QApplication object should already be constructed before accessing the clipboard.
void QApplication::closeAllWindows ( )
slot

Closes all top-level windows.

This method 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(), QWidget::isWindow()
int QApplication::colorSpec ( )
static

Returns the color specification.

See also
QApplication::setColorSpec()
void QApplication::commitDataRequest ( QSessionManager sessionManager)
signal

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 sessionManager for explicit permission. Refer to QSessionManager::allowsInteraction() and QSessionManager::allowsErrorInteraction() for details and example usage.
Note
You should use Qt::DirectConnection when connecting to this signal.
See also
isSessionRestored(), sessionId(), Session Management
int QApplication::cursorFlashTime ( )
static

Returns the value of the property cursorFlashTime.

QDesktopWidget * 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.

bool QApplication::desktopSettingsAware ( )
static

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

See also
setDesktopSettingsAware()
qreal QApplication::devicePixelRatio ( ) const

Returns the highest screen device pixel ratio found on the system. This is the ratio between physical pixels and device-independent pixels.

Use this method only when you do not know which window you are targeting. If you do know the target window, use QWindow::devicePixelRatio() instead.

See also
QWindow::devicePixelRatio()
int QApplication::doubleClickInterval ( )
static

Returns the value of the property doubleClickInterval.

bool QApplication::event ( QEvent event)
overrideprotectedvirtual

Reimplemented from QCoreApplication::event()

int QApplication::exec ( )
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 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 CopperSpice 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.

See also
quitOnLastWindowClosed, quit(), exit(), processEvents(), QCoreApplication::exec()
void QApplication::focusChanged ( QWidget old,
QWidget current 
)
signal

This signal is emitted when the widget that has keyboard focus changes from old to current. For example if the users pressed the tab-key, clicked into a widget or changed the active window. Both old and current can be the null-pointer.

The signal is emitted after both widget have been notified about the change through QFocusEvent.

See also
QWidget::setFocus(), QWidget::clearFocus(), Qt::FocusReason
QObject * QApplication::focusObject ( )
static

Returns the QObject in currently active window that will be final receiver of events tied to focus, such as key events.

void QApplication::focusObjectChanged ( QObject focusObject)
signal

This signal is emitted when final receiver of events tied to focus is changed. The parameter focusObject is the new receiver.

See also
focusObject()
QWidget * QApplication::focusWidget ( )
static

Returns the application widget that has the keyboard input focus or a nullptr if no widget in this application has focus.

See also
QWidget::setFocus(), QWidget::hasFocus(), activeWindow(), focusChanged()
QWindow * QApplication::focusWindow ( )
static

Returns the QWindow that receives events tied to focus, such as key events.

void QApplication::focusWindowChanged ( QWindow focusWindow)
signal

This signal is emitted when the focused window changes. The parameter focusWindow is the new focused window.

See also
focusWindow()
QFont QApplication::font ( )
static

Returns the default application font.

See also
setFont(), fontMetrics(), QWidget::font()
QFont QApplication::font ( const QString className)
static

Returns the font for widgets of the given className.

See also
setFont(), QWidget::font()
QFont QApplication::font ( const QWidget widget)
static

Returns the default font for the widget.

See also
fontMetrics(), QWidget::setFont()
void QApplication::fontDatabaseChanged ( )
signal
QFontMetrics QApplication::fontMetrics ( )
static

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

See also
font(), setFont(), QWidget::fontMetrics(), QPainter::fontMetrics()
QSize QApplication::globalStrut ( )
static

Returns the value of the property globalStrutf.

QInputMethod * QApplication::inputMethod ( )
static

Returns the input method.

The input method returns properties about the state and position of the virtual keyboard. It also provides information about the position of the current focused input element.

See also
QInputMethod
bool QApplication::isEffectEnabled ( Qt::UIEffect  effect)
static

Returns true if effect is enabled, otherwise returns false. By default, CopperSpice 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(), Qt::UIEffect
bool QApplication::isFallbackSessionManagementEnabled ( )
static

Returns whether QApplication will use fallback session management. The default is true.

If this is true and the session manager allows user interaction, QApplication will try to close toplevel windows after commitDataRequest() has been emitted. If a window cannot be closed, session shutdown will be canceled and the application will keep running.

Fallback session management only benefits applications that have an "are you sure you want to close this window?" feature or other logic that prevents closing a toplevel window depending on certain conditions, and that do nothing to explicitly implement session management. In applications that do implement session management using the proper session management API, fallback session management interferes and may break session management logic.

Warning: If all windows are closed due to fallback session management and quitOnLastWindowClosed() is true, the application will quit before it is explicitly instructed to quit through the platform's session management protocol. That violation of protocol may prevent the platform session manager from saving application state.

See also
setFallbackSessionManagementEnabled(), QSessionManager::allowsInteraction(), saveStateRequest(), commitDataRequest(), Session Management
bool QApplication::isLeftToRight ( )
inlinestatic

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

See also
layoutDirection(), isRightToLeft()
bool QApplication::isRightToLeft ( )
inlinestatic

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

See also
layoutDirection(), isLeftToRight()
bool QApplication::isSavingSession ( ) const

Returns true if the application is currently saving the session, otherwise returns false. This is true when commitDataRequest() and saveStateRequest() are emitted, but also when the windows are closed afterwards by session management.

See also
sessionId(), commitDataRequest(), saveStateRequest()
bool QApplication::isSessionRestored ( ) const

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

See also
sessionId(), commitDataRequest(), saveStateRequest()
int QApplication::keyboardInputInterval ( )
static

Returns the value of the property keyboardInputInterval.

Qt::KeyboardModifiers QApplication::keyboardModifiers ( )
static

Returns the current state of the modifier keys on the keyboard. The current state is updated synchronously 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(), queryKeyboardModifiers()
void QApplication::lastWindowClosed ( )
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
  • QApplication implicitly quits when this signal is emitted.

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

See also
QWidget::close()
Qt::LayoutDirection QApplication::layoutDirection ( )
static

Returns the value of the property layoutDirection.

void QApplication::layoutDirectionChanged ( Qt::LayoutDirection  direction)
signal

Sets the value of the property to direction.

QWindow * QApplication::modalWindow ( )
static

Returns the most recently shown modal window. If no modal windows are visible, this method returns a nullptr.

A modal window is a window which has its modality property set to either Qt::WindowModal or Qt::ApplicationModal. A modal window must be closed before the user can continue with other parts of the program. Modal window are organized in a stack. Returns the modal window at the top of the stack.

See also
Qt::WindowModality, QWindow::setModality()
Qt::MouseButtons QApplication::mouseButtons ( )
static

Returns the current state of the buttons on the mouse. The current state is updated synchronously 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()
bool QApplication::notify ( QObject receiver,
QEvent event 
)
overridevirtual

Reimplemented from QCoreApplication::notify()

QCursor * QApplication::overrideCursor ( )
static

Returns the active application override cursor. Returns nullptr if no application cursor has been defined.

See also
setOverrideCursor(), restoreOverrideCursor()
QPalette QApplication::palette ( )
static

Returns the application palette.

See also
setPalette(), QWidget::palette()
QPalette QApplication::palette ( const QString className)
static

Returns the palette for widgets of the given className.

See also
setPalette(), QWidget::palette()
QPalette QApplication::palette ( const QWidget widget)
static

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(), QWidget::palette()
void QApplication::paletteChanged ( const QPalette palette)
signal

Sets the value of the property to palette.

FP_Void QApplication::platformFunction ( const QByteArray function)
static

Returns a function pointer to the platformplugin matching the given function.

QString QApplication::platformName ( )
static

Returns the value of the property platformName.

QPlatformNativeInterface * QApplication::platformNativeInterface ( )
static

Returns the platform's native interface, for platform specific functionality.

QScreen * QApplication::primaryScreen ( )
static

Returns the value of the property primaryScreen.

void QApplication::primaryScreenChanged ( QScreen screen)
signal

Sets the value of the property to screen.

Qt::KeyboardModifiers 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. 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.

See also
keyboardModifiers()
bool QApplication::quitOnLastWindowClosed ( )
static

Returns the value of the property quitOnLastWindowClosed.

void 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(), overrideCursor()
void QApplication::saveStateRequest ( QSessionManager sessionManager)
signal

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. Furthermore, 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 sessionManager for explicit permission. See QSessionManager::allowsInteraction() and QSessionManager::allowsErrorInteraction() for details.
Note
You should use Qt::DirectConnection when connecting to this signal.
See also
isSessionRestored(), sessionId(), commitDataRequest(), Session Management
void QApplication::screenAdded ( QScreen screen)
signal

This signal is emitted whenever a new screen has been added to the system.

See also
screens(), primaryScreen, screenRemoved()
void QApplication::screenRemoved ( QScreen screen)
signal

This signal is emitted whenever a screen is removed from the system. It provides an opportunity to manage the windows on the screen before CopperSpice falls back to moving them to the primary screen.

See also
screens(), screenAdded(), QObject::destroyed(), QWindow::setScreen()
QList< QScreen * > QApplication::screens ( )
static

Returns a list of all the screens associated with the windowing system the application is connected to.

QString QApplication::sessionId ( ) const

Returns the current session 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(), commitDataRequest(), saveStateRequest()
QString QApplication::sessionKey ( ) const

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 commitDataRequest() or saveStateRequest().

See also
isSessionRestored(), sessionId(), commitDataRequest(), saveStateRequest()
void QApplication::setActiveWindow ( QWidget active)
static

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

Warning
This method 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.

See also
activeWindow(), QWidget::activateWindow()
void QApplication::setApplicationDisplayName ( const QString name)
static

Sets the value of the property to name. The given name will appear as a suffix in every window title.

void QApplication::setAutoSipEnabled ( const bool  enabled)
slot

Sets the value of the property to enabled.

void QApplication::setColorSpec ( int  spec)
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, for example 8 bit / 256 color displays. The color specification must be set before you create the QApplication object.

The options are shown below.

  • 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, CopperSpice 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.
    For 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, CopperSpice 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.

int main(int argc, char *argv[]) {
QApplication::setColorSpec(QApplication::ManyColor);
QApplication app(argc, argv);
...
return app.exec();
}
See also
colorSpec()
void QApplication::setCursorFlashTime ( int  duration)
static

Sets the value of the property to duration.

void QApplication::setDesktopSettingsAware ( bool  on)
static

Sets whether CopperSpice should use the system's standard colors, fonts, etc., to on. By default, this is true. This method must be called before creating the QApplication object, like this:

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
...
return app.exec();
}
See also
desktopSettingsAware()
void QApplication::setDoubleClickInterval ( int  interval)
static

Sets the value of the property to interval.

void QApplication::setEffectEnabled ( Qt::UIEffect  effect,
bool  enable = true 
)
static

Enables the UI effect if enable is true, otherwise the effect will not be used. All effects are disabled on screens running at less than 16-bit color depth.

See also
isEffectEnabled(), Qt::UIEffect, setDesktopSettingsAware()
void QApplication::setFallbackSessionManagementEnabled ( bool  enable)
static

Sets the value of the property to enable.

void QApplication::setFont ( const QFont font,
const QString className = QString() 
)
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 method in conjunction with 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(), QWidget::setFont()
void QApplication::setGlobalStrut ( const QSize size)
static

Sets the value of the property to size.

void QApplication::setKeyboardInputInterval ( int  interval)
static

Sets the value of the property to interval.

void QApplication::setLayoutDirection ( Qt::LayoutDirection  direction)
static

Sets the value of the property to direction.

void QApplication::setOverrideCursor ( const QCursor cursor)
static

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 currently active application override cursor.

Every setOverrideCursor() must eventually be followed by a corresponding restoreOverrideCursor(), otherwise the stack will never be emptied.

calculateHugeMandelbrot();
See also
overrideCursor(), restoreOverrideCursor(), changeOverrideCursor(), QWidget::setCursor()
void QApplication::setPalette ( const QPalette palette,
const QString className = QString() 
)
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 empty 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 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(), QStyle::polish()
void QApplication::setQuitOnLastWindowClosed ( bool  quit)
static

Sets the value of the property to quit.

void QApplication::setStartDragDistance ( int  distance)
static

Sets the value of the property to distance.

void QApplication::setStartDragTime ( int  time)
static

Sets the value of the property to time.

QStyle * QApplication::setStyle ( const QString style)
static

Requests a QStyle object for style from the QStyleFactory. The string must be one of the QStyleFactory::keys(), typically one of "windows", "windowsxp", "windowsvista", or "macintosh", "gtk", or "fusion". Style names are case insensitive.

Returns nullptr 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 method before the QApplication constructor, if possible.
void QApplication::setStyle ( QStyle style)
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.

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
CopperSpice style sheets are currently not supported for custom QStyle subclasses.
See also
style(), QStyle, setPalette(), desktopSettingsAware()
void QApplication::setStyleSheet ( const QString sheet)
slot

Sets the value of the property to sheet.

void QApplication::setWheelScrollLines ( int  lines)
static

Sets the value of the property to lines.

void QApplication::setWindowIcon ( const QIcon icon)
static

Sets the value of the property to icon.

int QApplication::startDragDistance ( )
static

Returns the value of the property startDragDistance.

int QApplication::startDragTime ( )
static

Returns the value of the property startDragTime.

QStyle * QApplication::style ( )
static

Returns the application's style object.

See also
setStyle(), QStyle
QStyleHints * QApplication::styleHints ( )
static

Returns the application style hints. The style hints encapsulate a set of platform dependent properties such as double click intervals and full width selection.

QString QApplication::styleSheet ( ) const

Returns the value of the property.

void QApplication::sync ( )
static

Used to synchronize the CopperSpice state with the Window Systems state.

This method will first empty events by calling QCoreApplication::processEvents(), then the platform plugin will sync up with the windowsystem, and finally events will be delivered by another call to QCoreApplication::processEvents();

QWidget * QApplication::topLevelWidgetAt ( const QPoint pos)
static

Returns the top level widget at the given point pos, returns a nullptr if there is no such widget.

QWidgetList QApplication::topLevelWidgets ( )
static

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

void showAllHiddenTopLevelWidgets() {
if (widget->isHidden()) {
widget->show();
}
}
}
Note
Some of the top-level widgets may be hidden.
See also
allWidgets(), QWidget::isWindow(), QWidget::isHidden()
QWindow * QApplication::topLevelWindowAt ( const QPoint pos)
static

Returns the top level window at the position of pos if a window exists.

QWindowList QApplication::topLevelWindows ( )
static

Returns a list of the top level windows in the application.

See also
allWindows()
int QApplication::wheelScrollLines ( )
static

Returns the value of the property wheelScrollLines.

QWidget * QApplication::widgetAt ( const QPoint point)
static

Returns the widget at global screen position point. Returns nullptr if there is no widget in that location. This method can be slow.

See also
QCursor::pos(), QWidget::grabMouse(), QWidget::grabKeyboard()
QWidget * QApplication::widgetAt ( int  x,
int  y 
)
inlinestatic

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

QIcon QApplication::windowIcon ( )
static

Returns the value of the property windowIcon.

Property Documentation

QApplication::applicationDisplayName

This property holds the user-visible name of this application

This name is shown to the user, for instance in window titles. It can be translated, if necessary. If not set, the application display name defaults to the application name.

PropertiesClass Methods
read applicationDisplayName
write setApplicationDisplayName
QApplication::autoSipEnabled

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 default is platform dependent.

PropertiesClass Methods
read autoSipEnabled
write setAutoSipEnabled
QApplication::cursorFlashTime

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.

PropertiesClass Methods
read cursorFlashTime
write setCursorFlashTime
QApplication::doubleClickInterval

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 calling this function sets the double click interval for all applications.

PropertiesClass Methods
read doubleClickInterval
write setDoubleClickInterval
QApplication::globalStrut

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.

QSize MyWidget::sizeHint() const {
}

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

PropertiesClass Methods
read globalStrut
write setGlobalStrut
QApplication::keyboardInputInterval

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.

PropertiesClass Methods
read keyboardInputInterval
write setKeyboardInputInterval
QApplication::layoutDirection

This property holds the default layout direction for this application. On system start-up the default layout direction depends on the application's language.

See also
QWidget::layoutDirection, isLeftToRight(), isRightToLeft()
PropertiesClass Methods
read layoutDirection
write setLayoutDirection
QApplication::platformName

This property holds the name of the underlying platform plugin. The following platform plugin names are supported.

cocoa
platform plugin for Mac OS X
windows
platform plugin for Windows desktop
xcb
platform plugin used on Linux platforms
PropertiesClass Methods
read platformName
stored true
QApplication::primaryScreen

This property holds the primary (or default) screen of the application. This will be the screen where QWindows are initially shown, unless otherwise specified.

PropertiesClass Methods
read primaryScreen
notify primaryScreenChanged
stored true
QApplication::quitOnLastWindowClosed

This property holds whether the application implicitly quits when the last window is closed. The default is true.

If this property is true, the application 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.

See also
quit(), QWidget::close()
PropertiesClass Methods
read quitOnLastWindowClosed
write setQuitOnLastWindowClosed
QApplication::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. The default value is 4 pixels.

For example, if the mouse position of the mouse click is stored in startPos and the current position is currentPos, you can find out if a drag should be started with code like the following.

if ((startPos - currentPos).manhattanLength() >= QApplication::startDragDistance()) {
startTheDrag();
}
See also
startDragTime(), QPoint::manhattanLength(), Drag and Drop
PropertiesClass Methods
read startDragDistance
write setStartDragDistance
QApplication::startDragTime

This property holds the time in milliseconds that a mouse button must be held down before a drag and drop operation will begin. The default value is 500 ms.

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.

See also
startDragDistance(), Drag and Drop
PropertiesClass Methods
read startDragTime
write setStartDragTime
QApplication::styleSheet

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.

See also
QWidget::setStyle(), Style Sheets
PropertiesClass Methods
read styleSheet
write setStyleSheet
QApplication::wheelScrollLines

This property holds the number of lines to scroll a widget, when the mouse wheel is rotated. By default this property has a value of 3.

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.

PropertiesClass Methods
read wheelScrollLines
write setWheelScrollLines
QApplication::windowIcon

This property holds the default windowIcon.

See also
QWidget::setWindowIcon(), Setting the Application Icon
PropertiesClass Methods
read windowIcon
write setWindowIcon