CopperSpice API
1.9.2
|
Manages the control flow and main settings of a GUI application. More...
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< QString > | dynamicPropertyNames () const |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
template<typename T > | |
T | findChild (const QString &childName=QString ()) const |
template<class T > | |
QList< T > | findChildren (const QRegularExpression ®Exp, 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 QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const |
QObject * | parent () const |
template<class T = QVariant> | |
T | 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) |
QThread * | thread () const |
Static Public Methods | |
static QWidget * | activeModalWidget () |
static QWidget * | activePopupWidget () |
static QWidget * | activeWindow () |
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 QClipboard * | clipboard () |
static int | colorSpec () |
static int | cursorFlashTime () |
static QDesktopWidget * | desktop () |
static bool | desktopSettingsAware () |
static int | doubleClickInterval () |
static int | exec () |
static QObject * | focusObject () |
static QWidget * | focusWidget () |
static QWindow * | focusWindow () |
static QFont | font () |
static QFont | font (const QString &className) |
static QFont | font (const QWidget *widget) |
static QFontMetrics | fontMetrics () |
static QSize | globalStrut () |
static QInputMethod * | inputMethod () |
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 QWindow * | modalWindow () |
static Qt::MouseButtons | mouseButtons () |
static QCursor * | overrideCursor () |
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 QPlatformNativeInterface * | platformNativeInterface () |
static QScreen * | primaryScreen () |
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 QStyle * | setStyle (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 QStyle * | style () |
static QStyleHints * | styleHints () |
static void | sync () |
static QWidget * | topLevelWidgetAt (const QPoint &pos) |
static QWidgetList | topLevelWidgets () |
static QWindow * | topLevelWindowAt (const QPoint &pos) |
static QWindowList | topLevelWindows () |
static int | wheelScrollLines () |
static QWidget * | widgetAt (const QPoint &point) |
static QWidget * | widgetAt (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 QMetaObject & | staticMetaObject () |
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) |
Additional Inherited Members | |
Related Functions inherited from QCoreApplication | |
void | qAddPostRoutine (QtCleanUpFunction ptr) |
void | qRemovePostRoutine (QtCleanUpFunction ptr) |
Related Functions inherited from QObject | |
T | qobject_cast (QObject *object) |
QObjectList | |
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.
The following is a summary of the key functionality for this class.
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.
Categories | Groups of Methods |
---|---|
System settings | desktopSettingsAware(), setDesktopSettingsAware(), cursorFlashTime(), setCursorFlashTime(), doubleClickInterval(), setDoubleClickInterval(), setKeyboardInputInterval(), wheelScrollLines(), setWheelScrollLines(), palette(), setPalette(), font(), setFont(), fontMetrics() |
Event handling | exec(), exit(), quit(), processEvents(), postEvent(), sendEvent(), sendPostedEvents(), removePostedEvents(), notify() |
GUI Styles | style(), setStyle() |
Color usage | colorSpec(), setColorSpec() |
Text handling | installTranslator(), removeTranslator() translate() |
Widgets | allWidgets(), topLevelWidgets(), desktop(), activePopupWidget(), activeModalWidget(), clipboard(), focusWidget(), activeWindow(), widgetAt() |
Cursor handling | overrideCursor(), setOverrideCursor(), restoreOverrideCursor() |
Miscellaneous | closeAllWindows(), startingUp(), closingDown() |
Typedef for a function pointer with no arguments which returns void.
Constant | Value | Description |
---|---|---|
QApplication::NormalColor | 0 | the default color allocation policy |
QApplication::CustomColor | 1 | the same as NormalColor for X11; allocates colors to a palette on demand under Windows |
QApplication::ManyColor | 2 | the right choice for applications that use thousands of colors |
Refer to setColorSpec() for full details.
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.
|
virtual |
Cleans up any window system resources that were allocated by this application. Sets the global variable qApp
to nullptr.
|
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().
|
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.
|
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.
|
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.
|
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.
|
static |
Returns a list of all the widgets in the application. The list is empty (QList::isEmpty()) if there are no widgets.
|
static |
Returns a list of all the windows in the application. The list is empty if there are no windows.
|
static |
Returns the value of the property applicationDisplayName.
|
static |
Returns the value of the property applicationState.
|
signal |
This signal is emitted when the state of the application changes.
|
slot |
Returns the value of the property autoSipEnabled.
|
static |
Sounds the bell using the default volume and sound.
|
static |
Changes the currently active application override cursor to cursor. This method has no effect if setOverrideCursor() was not called.
|
static |
Returns a pointer to the application global clipboard.
|
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:
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.
|
static |
Returns the color specification.
|
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.
|
static |
Returns the value of the property cursorFlashTime.
|
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.
|
static |
Returns true if CopperSpice is set to use the system's standard colors, fonts, etc., otherwise returns false. The default is true.
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.
|
static |
Returns the value of the property doubleClickInterval.
|
overrideprotectedvirtual |
Reimplemented from QCoreApplication::event()
|
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.
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.
|
static |
Returns the QObject in currently active window that will be final receiver of events tied to focus, such as key events.
|
signal |
This signal is emitted when final receiver of events tied to focus is changed. The parameter focusObject is the new receiver.
|
static |
Returns the application widget that has the keyboard input focus or a nullptr if no widget in this application has focus.
|
static |
Returns the QWindow that receives events tied to focus, such as key events.
|
signal |
This signal is emitted when the focused window changes. The parameter focusWindow is the new focused window.
|
static |
Returns the default application font.
Returns the font for widgets of the given className.
Returns the default font for the widget.
|
signal |
This signal is emitted when application fonts are loaded or removed.
|
static |
Returns display (screen) font metrics for the application font.
|
static |
Returns the value of the property globalStrutf.
|
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.
|
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).
|
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.
|
inlinestatic |
Returns true if the application's layout direction is Qt::LeftToRight, otherwise returns false.
|
inlinestatic |
Returns true if the application's layout direction is Qt::RightToLeft, otherwise returns false.
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.
bool QApplication::isSessionRestored | ( | ) | const |
Returns true if the application has been restored from an earlier session, otherwise returns false.
|
static |
Returns the value of the property keyboardInputInterval.
|
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.
|
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 feature can be turned off by setting quitOnLastWindowClosed to false.
|
static |
Returns the value of the property layoutDirection.
|
signal |
Sets the value of the property to direction.
|
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.
|
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.
Reimplemented from QCoreApplication::notify()
|
static |
Returns the active application override cursor. Returns nullptr if no application cursor has been defined.
|
static |
Returns the application palette.
Returns the palette for widgets of the given className.
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.
|
signal |
Sets the value of the property to palette.
|
static |
Returns a function pointer to the platformplugin matching the given function.
|
static |
Returns the value of the property platformName.
|
static |
Returns the platform's native interface, for platform specific functionality.
|
static |
Returns the value of the property primaryScreen.
|
signal |
Sets the value of the property to screen.
|
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.
|
static |
Returns the value of the property quitOnLastWindowClosed.
|
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.
|
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.
|
signal |
This signal is emitted whenever a new screen has been added to the system.
|
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.
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.
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().
|
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.
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.
|
static |
Sets the value of the property to name. The given name will appear as a suffix in every window title.
|
slot |
Sets the value of the property to enabled.
|
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::ManyColor. Use this option if your application is very color hungry, e.g., it requires thousands of colors.
For X11 the effect is:
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.
|
static |
Sets the value of the property to duration.
|
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:
|
static |
Sets the value of the property to interval.
|
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.
|
static |
Sets the value of the property to enable.
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.
|
static |
Sets the value of the property to size.
|
static |
Sets the value of the property to interval.
|
static |
Sets the value of the property to direction.
|
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.
|
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().
|
static |
Sets the value of the property to quit.
|
static |
Sets the value of the property to distance.
|
static |
Sets the value of the property to time.
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.
|
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.
|
slot |
Sets the value of the property to sheet.
|
static |
Sets the value of the property to lines.
|
static |
Sets the value of the property to icon.
|
static |
Returns the value of the property startDragDistance.
|
static |
Returns the value of the property startDragTime.
|
static |
Returns the application's style object.
|
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.
|
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();
Returns the top level widget at the given point pos, returns a nullptr if there is no such widget.
|
static |
Returns the top level window at the position of pos if a window exists.
|
static |
Returns a list of the top level windows in the application.
|
static |
Returns the value of the property wheelScrollLines.
Returns the widget at global screen position point. Returns nullptr if there is no widget in that location. This method can be slow.
|
inlinestatic |
Returns the widget at global screen position (x, y), or nullptr if there is no widget there.
|
static |
Returns the value of the property windowIcon.
|
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.
Properties | Class Methods |
---|---|
read | applicationDisplayName |
write | setApplicationDisplayName |
|
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.
Properties | Class Methods |
---|---|
read | autoSipEnabled |
write | setAutoSipEnabled |
|
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.
Properties | Class Methods |
---|---|
read | cursorFlashTime |
write | setCursorFlashTime |
|
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.
Properties | Class Methods |
---|---|
read | doubleClickInterval |
write | setDoubleClickInterval |
|
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.
By default, this property contains a QSize object with zero width and height.
Properties | Class Methods |
---|---|
read | globalStrut |
write | setGlobalStrut |
|
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.
Properties | Class Methods |
---|---|
read | keyboardInputInterval |
write | setKeyboardInputInterval |
|
This property holds the default layout direction for this application. On system start-up the default layout direction depends on the application's language.
Properties | Class Methods |
---|---|
read | layoutDirection |
write | setLayoutDirection |
|
This property holds the name of the underlying platform plugin. The following platform plugin names are supported.
Properties | Class Methods |
---|---|
read | platformName |
stored | true |
|
This property holds the primary (or default) screen of the application. This will be the screen where QWindows are initially shown, unless otherwise specified.
Properties | Class Methods |
---|---|
read | primaryScreen |
notify | primaryScreenChanged |
stored | true |
|
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.
Properties | Class Methods |
---|---|
read | quitOnLastWindowClosed |
write | setQuitOnLastWindowClosed |
|
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.
Properties | Class Methods |
---|---|
read | startDragDistance |
write | setStartDragDistance |
|
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.
Properties | Class Methods |
---|---|
read | startDragTime |
write | setStartDragTime |
|
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.
Properties | Class Methods |
---|---|
read | styleSheet |
write | setStyleSheet |
|
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.
Properties | Class Methods |
---|---|
read | wheelScrollLines |
write | setWheelScrollLines |
|
This property holds the default windowIcon.
Properties | Class Methods |
---|---|
read | windowIcon |
write | setWindowIcon |