[][src]Struct qt_widgets::QApplication

#[repr(C)]
pub struct QApplication { /* fields omitted */ }

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

C++ class: QApplication.

C++ documentation:

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

QApplication specializes QGuiApplication with some functionality needed for QWidget-based applications. It handles widget specific initialization, finalization.

For any GUI application using Qt, there is precisely one QApplication object, no matter whether the application has 0, 1, 2 or more windows at any given time. For non-QWidget based Qt applications, use QGuiApplication instead, as it does not depend on the QtWidgets library.

Some GUI applications provide a special batch mode ie. provide command line arguments for executing tasks without manual intervention. In such non-GUI mode, it is often sufficient to instantiate a plain QCoreApplication to avoid unnecessarily initializing resources needed for a graphical user interface. The following example shows how to dynamically create an appropriate type of application instance:

QCoreApplication createApplication(int &argc, char argv[]) { for (int i = 1; i < argc; ++i) if (!qstrcmp(argv[i], "-no-gui")) return new QCoreApplication(argc, argv); return new QApplication(argc, argv); }

int main(int argc, char* argv[]) { QScopedPointer<QCoreApplication> app(createApplication(argc, argv));

if (qobject_cast<QApplication *>(app.data())) { // start GUI version... } else { // start non-GUI version... }

return app->exec(); }

The QApplication object is accessible through the instance() function that returns a pointer equivalent to the global qApp pointer.

QApplication's main areas of responsibility are:

  • It initializes the application with the user's desktop settings such as palette(), font() and doubleClickInterval(). It keeps track of these properties in case the user changes the desktop globally, for example through some kind of control panel.
  • It performs event handling, meaning that it receives events from the underlying window system and dispatches them to the relevant widgets. By using sendEvent() and postEvent() you can send your own events to widgets.
  • It parses common command line arguments and sets its internal state accordingly. See the constructor documentation below for more details.
  • It defines the application's look and feel, which is encapsulated in a QStyle object. This can be changed at runtime with setStyle().
  • It specifies how the application is to allocate colors. See setColorSpec() for details.
  • It provides localization of strings that are visible to the user via translate().
  • It provides some magical objects like the desktop() and the clipboard().
  • It knows about the application's windows. You can ask which widget is at a certain position using widgetAt(), get a list of topLevelWidgets() and closeAllWindows(), etc.
  • It manages the application's mouse cursor handling, see setOverrideCursor()

Since the QApplication object does so much initialization, it must be created before any other objects related to the user interface are created. QApplication also deals with common command line arguments. Hence, it is usually a good idea to create it before any interpretation or modification of argv is done in the application itself.

Groups of functions
System settingsdesktopSettingsAware(), setDesktopSettingsAware(), cursorFlashTime(), setCursorFlashTime(), doubleClickInterval(), setDoubleClickInterval(), setKeyboardInputInterval(), wheelScrollLines(), setWheelScrollLines(), palette(), setPalette(), font(), setFont(), fontMetrics().
Event handlingexec(), processEvents(), exit(), quit(). sendEvent(), postEvent(), sendPostedEvents(), removePostedEvents(), hasPendingEvents(), notify().
GUI Stylesstyle(), setStyle().
Color usagecolorSpec(), setColorSpec().
Text handlinginstallTranslator(), removeTranslator() translate().
WidgetsallWidgets(), topLevelWidgets(), desktop(), activePopupWidget(), activeModalWidget(), clipboard(), focusWidget(), activeWindow(), widgetAt().
Advanced cursor handlingoverrideCursor(), setOverrideCursor(), restoreOverrideCursor().
MiscellaneouscloseAllWindows(), startingUp(), closingDown().

Methods

impl QApplication[src]

pub fn init<F: FnOnce(MutPtr<QApplication>) -> i32>(f: F) -> ![src]

A convenience function for performing proper initialization and de-initialization of a Qt application.

This function creates CoreApplication with valid argc and argv, calls the passed closure f(app) with the application object and exist the process with the exit code returned by the closure. The closure should perform the initialization of the application and either return immediately or call CoreApplication::exec() and return its return value:

use qt_widgets::QApplication;

fn main() {
    QApplication::init(|app| {
        unsafe {
            // initialization goes here
            QApplication::exec()
        }
    })
}

impl QApplication[src]

pub fn focus_changed(&self) -> Signal<(*mut QWidget, *mut QWidget)>[src]

This signal is emitted when the widget that has keyboard focus changed from old to now, i.e., because the user pressed the tab-key, clicked into a widget or changed the active window. Both old and now can be the null-pointer.

Returns a built-in Qt signal QApplication::focusChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when the widget that has keyboard focus changed from old to now, i.e., because the user pressed the tab-key, clicked into a widget or changed the active window. Both old and now can be the null-pointer.

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

This function was introduced in Qt 4.1.

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

pub fn slot_set_style_sheet(&self) -> Receiver<(*const QString,)>[src]

This property holds the application style sheet

Returns a built-in Qt slot QApplication::setStyleSheet that can be passed to qt_core::Signal::connect.

C++ documentation:

This property holds the application style sheet

By default, this property returns an empty string unless the user specifies the -stylesheet option on the command line when running the application.

This property was introduced in Qt 4.2.

Access functions:

QString styleSheet() const
void setStyleSheet(const QString &sheet)

See also QWidget::setStyle() and Qt Style Sheets.

pub fn slot_set_auto_sip_enabled(&self) -> Receiver<(bool,)>[src]

toggles automatic SIP (software input panel) visibility

Returns a built-in Qt slot QApplication::setAutoSipEnabled that can be passed to qt_core::Signal::connect.

C++ documentation:

toggles automatic SIP (software input panel) visibility

Set this property to true to automatically display the SIP when entering widgets that accept keyboard input. This property only affects widgets with the WA_InputMethodEnabled attribute set, and is typically used to launch a virtual keyboard on devices which have very few or no keys.

The property only has an effect on platforms that use software input panels.

The default is platform dependent.

This property was introduced in Qt 4.5.

Access functions:

bool autoSipEnabled() const
void setAutoSipEnabled(const bool enabled)

pub fn slot_auto_sip_enabled(&self) -> Receiver<()>[src]

toggles automatic SIP (software input panel) visibility

Returns a built-in Qt slot QApplication::autoSipEnabled that can be passed to qt_core::Signal::connect.

C++ documentation:

toggles automatic SIP (software input panel) visibility

Set this property to true to automatically display the SIP when entering widgets that accept keyboard input. This property only affects widgets with the WA_InputMethodEnabled attribute set, and is typically used to launch a virtual keyboard on devices which have very few or no keys.

The property only has an effect on platforms that use software input panels.

The default is platform dependent.

This property was introduced in Qt 4.5.

Access functions:

bool autoSipEnabled() const
void setAutoSipEnabled(const bool enabled)

pub fn slot_close_all_windows(&self) -> Receiver<()>[src]

Closes all top-level windows.

Returns a built-in Qt slot QApplication::closeAllWindows that can be passed to qt_core::Signal::connect.

C++ documentation:

Closes all top-level windows.

This function is particularly useful for applications with many top-level windows. It could, for example, be connected to a Exit entry in the File menu:

const QIcon exitIcon = QIcon::fromTheme("application-exit"); QAction *exitAct = fileMenu->addAction(exitIcon, tr("E&xit"), qApp, &QApplication::closeAllWindows); exitAct->setShortcuts(QKeySequence::Quit); exitAct->setStatusTip(tr("Exit the application")); fileMenu->addAction(exitAct);

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(), QCoreApplication::quit(), topLevelWidgets(), and QWidget::isWindow().

pub fn slot_about_qt(&self) -> Receiver<()>[src]

Displays a simple message box about Qt. The message includes the version number of Qt being used by the application.

Returns a built-in Qt slot QApplication::aboutQt that can be passed to qt_core::Signal::connect.

C++ documentation:

Displays a simple message box about Qt. The message includes the version number of Qt being used by the application.

This is useful for inclusion in the Help menu of an application, as shown in the Menus example.

This function is a convenience slot for QMessageBox::aboutQt().

pub unsafe fn about_qt()[src]

Displays a simple message box about Qt. The message includes the version number of Qt being used by the application.

Calls C++ function: static [slot] void QApplication::aboutQt().

C++ documentation:

Displays a simple message box about Qt. The message includes the version number of Qt being used by the application.

This is useful for inclusion in the Help menu of an application, as shown in the Menus example.

This function is a convenience slot for QMessageBox::aboutQt().

pub unsafe fn active_modal_widget() -> MutPtr<QWidget>[src]

Returns the active modal widget.

Calls C++ function: static QWidget* QApplication::activeModalWidget().

C++ documentation:

Returns the active modal widget.

A modal widget is a special top-level widget which is a subclass of QDialog that specifies the modal parameter of the constructor as true. A modal widget must be closed before the user can continue with other parts of the program.

Modal widgets are organized in a stack. This function returns the active modal widget at the top of the stack.

See also activePopupWidget() and topLevelWidgets().

pub unsafe fn active_popup_widget() -> MutPtr<QWidget>[src]

Returns the active popup widget.

Calls C++ function: static QWidget* QApplication::activePopupWidget().

C++ documentation:

Returns the active popup widget.

A popup widget is a special top-level widget that sets the Qt::WType_Popup widget flag, e.g. the QMenu widget. When the application opens a popup widget, all events are sent to the popup. Normal widgets and modal widgets cannot be accessed before the popup widget is closed.

Only other popup widgets may be opened when a popup widget is shown. The popup widgets are organized in a stack. This function returns the active popup widget at the top of the stack.

See also activeModalWidget() and topLevelWidgets().

pub unsafe fn active_window() -> MutPtr<QWidget>[src]

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

Calls C++ function: static QWidget* QApplication::activeWindow().

C++ documentation:

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

See also setActiveWindow(), QWidget::setFocus(), QWidget::hasFocus(), and focusWidget().

pub unsafe fn alert_2a(widget: impl CastInto<MutPtr<QWidget>>, duration: c_int)[src]

Causes an alert to be shown for widget if the window is not the active window. The alert is shown for msec miliseconds. If msec is zero (the default), then the alert is shown indefinitely until the window becomes active again.

Calls C++ function: static void QApplication::alert(QWidget* widget, int duration = …).

C++ documentation:

Causes an alert to be shown for widget if the window is not the active window. The alert is shown for msec miliseconds. If msec is zero (the default), then the alert is shown indefinitely until the window becomes active again.

Currently this function does nothing on Qt for Embedded Linux.

On macOS, this works more at the application level and will cause the application icon to bounce in the dock.

On Windows, this causes the window's taskbar entry to flash for a time. If msec is zero, the flashing will stop and the taskbar entry will turn a different color (currently orange).

On X11, this will cause the window to be marked as "demands attention", the window must not be hidden (i.e. not have hide() called on it, but be visible in some sort of way) in order for this to work.

This function was introduced in Qt 4.3.

pub unsafe fn alert_1a(widget: impl CastInto<MutPtr<QWidget>>)[src]

Causes an alert to be shown for widget if the window is not the active window. The alert is shown for msec miliseconds. If msec is zero (the default), then the alert is shown indefinitely until the window becomes active again.

Calls C++ function: static void QApplication::alert(QWidget* widget).

C++ documentation:

Causes an alert to be shown for widget if the window is not the active window. The alert is shown for msec miliseconds. If msec is zero (the default), then the alert is shown indefinitely until the window becomes active again.

Currently this function does nothing on Qt for Embedded Linux.

On macOS, this works more at the application level and will cause the application icon to bounce in the dock.

On Windows, this causes the window's taskbar entry to flash for a time. If msec is zero, the flashing will stop and the taskbar entry will turn a different color (currently orange).

On X11, this will cause the window to be marked as "demands attention", the window must not be hidden (i.e. not have hide() called on it, but be visible in some sort of way) in order for this to work.

This function was introduced in Qt 4.3.

pub unsafe fn all_widgets() -> CppBox<QListOfQWidget>[src]

Returns a list of all the widgets in the application.

Calls C++ function: static QList<QWidget*> QApplication::allWidgets().

C++ documentation:

Returns a list of all the widgets in the application.

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

Note: Some of the widgets may be hidden.

Example:

void updateAllWidgets() { foreach (QWidget *widget, QApplication::allWidgets()) widget->update(); }

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

pub unsafe fn auto_sip_enabled(&self) -> bool[src]

toggles automatic SIP (software input panel) visibility

Calls C++ function: [slot] bool QApplication::autoSipEnabled() const.

C++ documentation:

toggles automatic SIP (software input panel) visibility

Set this property to true to automatically display the SIP when entering widgets that accept keyboard input. This property only affects widgets with the WA_InputMethodEnabled attribute set, and is typically used to launch a virtual keyboard on devices which have very few or no keys.

The property only has an effect on platforms that use software input panels.

The default is platform dependent.

This property was introduced in Qt 4.5.

Access functions:

bool autoSipEnabled() const
void setAutoSipEnabled(const bool enabled)

pub unsafe fn beep()[src]

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

Calls C++ function: static void QApplication::beep().

C++ documentation:

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

pub unsafe fn close_all_windows()[src]

Closes all top-level windows.

Calls C++ function: static [slot] void QApplication::closeAllWindows().

C++ documentation:

Closes all top-level windows.

This function is particularly useful for applications with many top-level windows. It could, for example, be connected to a Exit entry in the File menu:

const QIcon exitIcon = QIcon::fromTheme("application-exit"); QAction *exitAct = fileMenu->addAction(exitIcon, tr("E&xit"), qApp, &QApplication::closeAllWindows); exitAct->setShortcuts(QKeySequence::Quit); exitAct->setStatusTip(tr("Exit the application")); fileMenu->addAction(exitAct);

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(), QCoreApplication::quit(), topLevelWidgets(), and QWidget::isWindow().

pub unsafe fn color_spec() -> c_int[src]

Returns the color specification.

Calls C++ function: static int QApplication::colorSpec().

C++ documentation:

Returns the color specification.

See also QApplication::setColorSpec().

pub unsafe fn cursor_flash_time() -> c_int[src]

This property holds the text cursor's flash (blink) time in milliseconds

Calls C++ function: static int QApplication::cursorFlashTime().

C++ documentation:

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.

Note: This property may hold a negative value, for instance if cursor blinking is disabled.

Access functions:

int cursorFlashTime()
void setCursorFlashTime(int)

pub unsafe fn desktop() -> MutPtr<QDesktopWidget>[src]

Returns the desktop widget (also called the root window).

Calls C++ function: static QDesktopWidget* QApplication::desktop().

C++ documentation:

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.

pub unsafe fn double_click_interval() -> c_int[src]

This property holds the time limit in milliseconds that distinguishes a double click from two consecutive mouse clicks

Calls C++ function: static int QApplication::doubleClickInterval().

C++ documentation:

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.

Access functions:

int doubleClickInterval()
void setDoubleClickInterval(int)

pub unsafe fn exec() -> c_int[src]

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

Calls C++ function: static int QApplication::exec().

C++ documentation:

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 Qt closes all top-level windows. Hence, there is no guarantee that the application will have time to exit its event loop and execute code at the end of the main() function, after the QApplication::exec() call.

See also quitOnLastWindowClosed, QCoreApplication::quit(), QCoreApplication::exit(), QCoreApplication::processEvents(), and QCoreApplication::exec().

pub unsafe fn focus_widget() -> MutPtr<QWidget>[src]

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

Calls C++ function: static QWidget* QApplication::focusWidget().

C++ documentation:

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

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

pub unsafe fn font() -> CppBox<QFont>[src]

Returns the default application font.

Calls C++ function: static QFont QApplication::font().

C++ documentation:

Returns the default application font.

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

pub unsafe fn font_q_widget(arg1: impl CastInto<Ptr<QWidget>>) -> CppBox<QFont>[src]

This is an overloaded function.

Calls C++ function: static QFont QApplication::font(const QWidget* arg1).

C++ documentation:

This is an overloaded function.

Returns the default font for the widget.

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

pub unsafe fn font_char(class_name: impl CastInto<Ptr<c_char>>) -> CppBox<QFont>[src]

This is an overloaded function.

Calls C++ function: static QFont QApplication::font(const char* className).

C++ documentation:

This is an overloaded function.

Returns the font for widgets of the given className.

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

pub unsafe fn font_metrics() -> CppBox<QFontMetrics>[src]

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

Calls C++ function: static QFontMetrics QApplication::fontMetrics().

C++ documentation:

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

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

pub unsafe fn global_strut() -> CppBox<QSize>[src]

This property holds the minimum size that any GUI element that the user can interact with should have

Calls C++ function: static QSize QApplication::globalStrut().

C++ documentation:

This property holds the minimum size that any GUI element that the user can interact with should have

For example, no button should be resized to be smaller than the global strut size. The strut size should be considered when reimplementing GUI controls that may be used on touch-screens or similar I/O devices.

Example:

QSize MyWidget::sizeHint() const { return QSize(80, 25).expandedTo(QApplication::globalStrut()); }

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

Access functions:

QSize globalStrut()
void setGlobalStrut(const QSize &)

pub unsafe fn is_effect_enabled(arg1: UIEffect) -> bool[src]

Returns true if effect is enabled; otherwise returns false.

Calls C++ function: static bool QApplication::isEffectEnabled(Qt::UIEffect arg1).

C++ documentation:

Returns true if effect is enabled; otherwise returns false.

By default, Qt will try to use the desktop settings. To prevent this, call setDesktopSettingsAware(false).

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

See also setEffectEnabled() and Qt::UIEffect.

pub unsafe fn keyboard_input_interval() -> c_int[src]

This property holds the time limit in milliseconds that distinguishes a key press from two consecutive key presses

Calls C++ function: static int QApplication::keyboardInputInterval().

C++ documentation:

This property holds the time limit in milliseconds that distinguishes a key press from two consecutive key presses

The default value on X11 is 400 milliseconds. On Windows and Mac OS, the operating system's value is used.

This property was introduced in Qt 4.2.

Access functions:

int keyboardInputInterval()
void setKeyboardInputInterval(int)

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QApplication::metaObject() const.

pub unsafe fn new_3a(
    argc: impl CastInto<MutRef<c_int>>,
    argv: impl CastInto<MutPtr<*mut c_char>>,
    arg3: c_int
) -> CppBox<QApplication>
[src]

Initializes the window system and constructs an application object with argc command line arguments in argv.

Calls C++ function: [constructor] void QApplication::QApplication(int& argc, char** argv, int arg3 = …).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for QApplication::QApplication(int &argc, char **argv):

Initializes the window system and constructs an application object with argc command line arguments in argv.

Warning: The data referred to by argc and argv must stay 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.

The global qApp pointer refers to this application object. Only one application object should be created.

This application object must be constructed before any paint devices (including widgets, pixmaps, bitmaps etc.).

Note: argc and argv might be changed as Qt removes command line arguments that it recognizes.

All Qt programs automatically support the following command line options:

  • -style= style, sets the application GUI style. Possible values depend on your system configuration. If you compiled Qt with additional styles or have additional styles as plugins these will be available to the -style command line option. You can also set the style for all Qt applications by setting the QT_STYLE_OVERRIDE environment variable.
  • -style style, is the same as listed above.
  • -stylesheet= stylesheet, sets the application styleSheet. The value must be a path to a file that contains the Style Sheet.

    Note: Relative URLs in the Style Sheet file are relative to the Style Sheet file's path.

  • -stylesheet stylesheet, is the 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
  • -qmljsdebugger=, activates the QML/JS debugger with a specified port. The value must be of format port:1234[,block], where block is optional and will make the application wait until a debugger connects to it.

See also QCoreApplication::arguments().

pub unsafe fn new_2a(
    argc: impl CastInto<MutRef<c_int>>,
    argv: impl CastInto<MutPtr<*mut c_char>>
) -> CppBox<QApplication>
[src]

Initializes the window system and constructs an application object with argc command line arguments in argv.

Calls C++ function: [constructor] void QApplication::QApplication(int& argc, char** argv).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for QApplication::QApplication(int &argc, char **argv):

Initializes the window system and constructs an application object with argc command line arguments in argv.

Warning: The data referred to by argc and argv must stay 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.

The global qApp pointer refers to this application object. Only one application object should be created.

This application object must be constructed before any paint devices (including widgets, pixmaps, bitmaps etc.).

Note: argc and argv might be changed as Qt removes command line arguments that it recognizes.

All Qt programs automatically support the following command line options:

  • -style= style, sets the application GUI style. Possible values depend on your system configuration. If you compiled Qt with additional styles or have additional styles as plugins these will be available to the -style command line option. You can also set the style for all Qt applications by setting the QT_STYLE_OVERRIDE environment variable.
  • -style style, is the same as listed above.
  • -stylesheet= stylesheet, sets the application styleSheet. The value must be a path to a file that contains the Style Sheet.

    Note: Relative URLs in the Style Sheet file are relative to the Style Sheet file's path.

  • -stylesheet stylesheet, is the 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
  • -qmljsdebugger=, activates the QML/JS debugger with a specified port. The value must be of format port:1234[,block], where block is optional and will make the application wait until a debugger connects to it.

See also QCoreApplication::arguments().

pub unsafe fn notify(
    &mut self,
    arg1: impl CastInto<MutPtr<QObject>>,
    arg2: impl CastInto<MutPtr<QEvent>>
) -> bool
[src]

Reimplemented from QGuiApplication::notify().

Calls C++ function: virtual bool QApplication::notify(QObject* arg1, QEvent* arg2).

C++ documentation:

Reimplemented from QGuiApplication::notify().

pub unsafe fn palette_q_widget(
    arg1: impl CastInto<Ptr<QWidget>>
) -> CppBox<QPalette>
[src]

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.

Calls C++ function: static QPalette QApplication::palette(const QWidget* arg1).

C++ documentation:

If a widget is passed, the default palette for the widget's class is returned. This may or may not be the application palette. In most cases there is no special palette for certain types of widgets, but one notable exception is the popup menu under Windows, if the user has defined a special background color for menus in the display settings.

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

pub unsafe fn palette_char(
    class_name: impl CastInto<Ptr<c_char>>
) -> CppBox<QPalette>
[src]

This is an overloaded function.

Calls C++ function: static QPalette QApplication::palette(const char* className).

C++ documentation:

This is an overloaded function.

Returns the palette for widgets of the given className.

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

pub unsafe fn qt_metacall(
    &mut self,
    arg1: Call,
    arg2: c_int,
    arg3: impl CastInto<MutPtr<*mut c_void>>
) -> c_int
[src]

Calls C++ function: virtual int QApplication::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(
    &mut self,
    arg1: impl CastInto<Ptr<c_char>>
) -> MutPtr<c_void>
[src]

Calls C++ function: virtual void* QApplication::qt_metacast(const char* arg1).

pub unsafe fn set_active_window(act: impl CastInto<MutPtr<QWidget>>)[src]

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

Calls C++ function: static void QApplication::setActiveWindow(QWidget* act).

C++ documentation:

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

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

It sets the activeWindow() and focusWidget() attributes and sends proper WindowActivate/WindowDeactivate and FocusIn/FocusOut events to all appropriate widgets. The window will then be painted in active state (e.g. cursors in line edits will blink), and it will have tool tips enabled.

See also activeWindow() and QWidget::activateWindow().

pub unsafe fn set_auto_sip_enabled(&mut self, enabled: bool)[src]

toggles automatic SIP (software input panel) visibility

Calls C++ function: [slot] void QApplication::setAutoSipEnabled(bool enabled).

C++ documentation:

toggles automatic SIP (software input panel) visibility

Set this property to true to automatically display the SIP when entering widgets that accept keyboard input. This property only affects widgets with the WA_InputMethodEnabled attribute set, and is typically used to launch a virtual keyboard on devices which have very few or no keys.

The property only has an effect on platforms that use software input panels.

The default is platform dependent.

This property was introduced in Qt 4.5.

Access functions:

bool autoSipEnabled() const
void setAutoSipEnabled(const bool enabled)

pub unsafe fn set_color_spec(arg1: c_int)[src]

Sets the color specification for the application to spec.

Calls C++ function: static void QApplication::setColorSpec(int arg1).

C++ documentation:

Sets the color specification for the application to spec.

This call has no effect.

The color specification controls how the application allocates colors when run on a display with a limited amount of colors, e.g. 8 bit / 256 color displays.

The color specification must be set before you create the QApplication object.

The options are:

  • QApplication::NormalColor. This is the default color allocation strategy. Use this option if your application uses buttons, menus, texts and pixmaps with few colors. With this option, the application uses system global colors. This works fine for most applications under X11, but on the Windows platform, it may cause dithering of non-standard colors.
  • QApplication::CustomColor. Use this option if your application needs a small number of custom colors. On X11, this option is the same as NormalColor. On Windows, Qt creates a Windows palette, and allocates colors to it on demand.
  • QApplication::ManyColor. Use this option if your application is very color hungry, e.g., it requires thousands of colors.
    Under X11 the effect is:
    • For 256-color displays which have at best a 256 color true color visual, the default visual is used, and colors are allocated from a color cube. The color cube is the 6x6x6 (216 color) "Web palette" (the red, green, and blue components always have one of the following values: 0x00, 0x33, 0x66, 0x99, 0xCC, or 0xFF), but the number of colors can be changed by the -ncols option. The user can force the application to use the true color visual with the -visual option.
    • For 256-color displays which have a true color visual with more than 256 colors, use that visual. Silicon Graphics X servers this feature, for example. They provide an 8 bit visual by default but can deliver true color when asked.

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

Be aware that the CustomColor and ManyColor choices may lead to colormap flashing: The foreground application gets (most) of the available colors, while the background windows will look less attractive.

Example:

int main(int argc, char *argv[]) { QApplication::setColorSpec(QApplication::ManyColor); QApplication app(argc, argv); ... return app.exec(); }

See also colorSpec().

pub unsafe fn set_cursor_flash_time(arg1: c_int)[src]

This property holds the text cursor's flash (blink) time in milliseconds

Calls C++ function: static void QApplication::setCursorFlashTime(int arg1).

C++ documentation:

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.

Note: This property may hold a negative value, for instance if cursor blinking is disabled.

Access functions:

int cursorFlashTime()
void setCursorFlashTime(int)

pub unsafe fn set_double_click_interval(arg1: c_int)[src]

This property holds the time limit in milliseconds that distinguishes a double click from two consecutive mouse clicks

Calls C++ function: static void QApplication::setDoubleClickInterval(int arg1).

C++ documentation:

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.

Access functions:

int doubleClickInterval()
void setDoubleClickInterval(int)

pub unsafe fn set_effect_enabled_2a(arg1: UIEffect, enable: bool)[src]

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

Calls C++ function: static void QApplication::setEffectEnabled(Qt::UIEffect arg1, bool enable = …).

C++ documentation:

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

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

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

pub unsafe fn set_effect_enabled_1a(arg1: UIEffect)[src]

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

Calls C++ function: static void QApplication::setEffectEnabled(Qt::UIEffect arg1).

C++ documentation:

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

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

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

pub unsafe fn set_font_2a(
    arg1: impl CastInto<Ref<QFont>>,
    class_name: impl CastInto<Ptr<c_char>>
)
[src]

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

Calls C++ function: static void QApplication::setFont(const QFont& arg1, const char* className = …).

C++ documentation:

Changes the default application font to font. If className is passed, the change applies only to classes that inherit className (as reported by QObject::inherits()).

On application start-up, the default font depends on the window system. It can vary depending on both the window system version and the locale. This function lets you override the default font; but overriding may be a bad idea because, for example, some locales need extra large fonts to support their special characters.

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

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

pub unsafe fn set_font_1a(arg1: impl CastInto<Ref<QFont>>)[src]

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

Calls C++ function: static void QApplication::setFont(const QFont& arg1).

C++ documentation:

Changes the default application font to font. If className is passed, the change applies only to classes that inherit className (as reported by QObject::inherits()).

On application start-up, the default font depends on the window system. It can vary depending on both the window system version and the locale. This function lets you override the default font; but overriding may be a bad idea because, for example, some locales need extra large fonts to support their special characters.

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

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

pub unsafe fn set_global_strut(arg1: impl CastInto<Ref<QSize>>)[src]

This property holds the minimum size that any GUI element that the user can interact with should have

Calls C++ function: static void QApplication::setGlobalStrut(const QSize& arg1).

C++ documentation:

This property holds the minimum size that any GUI element that the user can interact with should have

For example, no button should be resized to be smaller than the global strut size. The strut size should be considered when reimplementing GUI controls that may be used on touch-screens or similar I/O devices.

Example:

QSize MyWidget::sizeHint() const { return QSize(80, 25).expandedTo(QApplication::globalStrut()); }

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

Access functions:

QSize globalStrut()
void setGlobalStrut(const QSize &)

pub unsafe fn set_keyboard_input_interval(arg1: c_int)[src]

This property holds the time limit in milliseconds that distinguishes a key press from two consecutive key presses

Calls C++ function: static void QApplication::setKeyboardInputInterval(int arg1).

C++ documentation:

This property holds the time limit in milliseconds that distinguishes a key press from two consecutive key presses

The default value on X11 is 400 milliseconds. On Windows and Mac OS, the operating system's value is used.

This property was introduced in Qt 4.2.

Access functions:

int keyboardInputInterval()
void setKeyboardInputInterval(int)

pub unsafe fn set_palette_2a(
    arg1: impl CastInto<Ref<QPalette>>,
    class_name: impl CastInto<Ptr<c_char>>
)
[src]

Changes the default application palette to palette.

Calls C++ function: static void QApplication::setPalette(const QPalette& arg1, const char* className = …).

C++ documentation:

Changes the default application palette to palette.

If className is passed, the change applies only to widgets that inherit className (as reported by QObject::inherits()). If className is left 0, the change affects all widgets, thus overriding any previously set class specific palettes.

The palette may be changed according to the current GUI style in QStyle::polish().

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

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

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

pub unsafe fn set_palette_1a(arg1: impl CastInto<Ref<QPalette>>)[src]

Changes the default application palette to palette.

Calls C++ function: static void QApplication::setPalette(const QPalette& arg1).

C++ documentation:

Changes the default application palette to palette.

If className is passed, the change applies only to widgets that inherit className (as reported by QObject::inherits()). If className is left 0, the change affects all widgets, thus overriding any previously set class specific palettes.

The palette may be changed according to the current GUI style in QStyle::polish().

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

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

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

pub unsafe fn set_start_drag_distance(l: c_int)[src]

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.

Calls C++ function: static void QApplication::setStartDragDistance(int l).

C++ documentation:

If you support drag and drop in your application, and want to start a drag and drop operation after the user has moved the cursor a certain distance with a button held down, you should use this property's value as the minimum distance required.

For example, if the mouse position of the click is stored in startPos and the current position (e.g. in the mouse move event) is currentPos, you can find out if a drag should be started with code like this:

int main(int argc, char *argv[]) { QApplication::setDesktopSettingsAware(false); QApplication app(argc, argv); ... return app.exec(); }

Qt uses this value internally, e.g. in QFileDialog.

The default value (if the platform doesn't provide a different default) is 10 pixels.

Access functions:

int startDragDistance()
void setStartDragDistance(int l)

See also startDragTime(), QPoint::manhattanLength(), and Drag and Drop.

pub unsafe fn set_start_drag_time(ms: c_int)[src]

This property holds the time in milliseconds that a mouse button must be held down before a drag and drop operation will begin

Calls C++ function: static void QApplication::setStartDragTime(int ms).

C++ documentation:

This property holds the time in milliseconds that a mouse button must be held down before a drag and drop operation will begin

If you support drag and drop in your application, and want to start a drag and drop operation after the user has held down a mouse button for a certain amount of time, you should use this property's value as the delay.

Qt also uses this delay internally, e.g. in QTextEdit and QLineEdit, for starting a drag.

The default value is 500 ms.

Access functions:

int startDragTime()
void setStartDragTime(int ms)

See also startDragDistance() and Drag and Drop.

pub unsafe fn set_style_q_style(arg1: impl CastInto<MutPtr<QStyle>>)[src]

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.

Calls C++ function: static void QApplication::setStyle(QStyle* arg1).

C++ documentation:

Sets the application's GUI style to style. Ownership of the style object is transferred to QApplication, so QApplication will delete the style object on application exit or when a new style is set and the old style is still the parent of the application object.

Example usage:

QApplication::setStyle(QStyleFactory::create("Fusion"));

When switching application styles, the color palette is set back to the initial colors or the system defaults. This is necessary since certain styles have to adapt the color palette to be fully style-guide compliant.

Setting the style before a palette has been set, i.e., before creating QApplication, will cause the application to use QStyle::standardPalette() for the palette.

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

See also style(), QStyle, setPalette(), and desktopSettingsAware().

pub unsafe fn set_style_q_string(
    arg1: impl CastInto<Ref<QString>>
) -> MutPtr<QStyle>
[src]

This is an overloaded function.

Calls C++ function: static QStyle* QApplication::setStyle(const QString& arg1).

C++ documentation:

This is an overloaded function.

Requests a QStyle object for style from the QStyleFactory.

The string must be one of the QStyleFactory::keys(), typically one of "windows", "fusion", "windowsxp", or "macintosh". Style names are case insensitive.

Returns 0 if an unknown style is passed, otherwise the QStyle object returned is set as the application's GUI style.

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

pub unsafe fn set_style_sheet(&mut self, sheet: impl CastInto<Ref<QString>>)[src]

This property holds the application style sheet

Calls C++ function: [slot] void QApplication::setStyleSheet(const QString& sheet).

C++ documentation:

This property holds the application style sheet

By default, this property returns an empty string unless the user specifies the -stylesheet option on the command line when running the application.

This property was introduced in Qt 4.2.

Access functions:

QString styleSheet() const
void setStyleSheet(const QString &sheet)

See also QWidget::setStyle() and Qt Style Sheets.

pub unsafe fn set_wheel_scroll_lines(arg1: c_int)[src]

This property holds the number of lines to scroll a widget, when the mouse wheel is rotated.

Calls C++ function: static void QApplication::setWheelScrollLines(int arg1).

C++ documentation:

This property holds the number of lines to scroll a widget, when the mouse wheel is rotated.

If the value exceeds the widget's number of visible lines, the widget should interpret the scroll operation as a single page up or page down. If the widget is an item view class, then the result of scrolling one line depends on the setting of the widget's scroll mode. Scroll one line can mean scroll one item or scroll one pixel.

By default, this property has a value of 3.

Access functions:

int wheelScrollLines()
void setWheelScrollLines(int)

See also QStyleHints::wheelScrollLines().

pub unsafe fn set_window_icon(icon: impl CastInto<Ref<QIcon>>)[src]

This property holds the default window icon

Calls C++ function: static void QApplication::setWindowIcon(const QIcon& icon).

C++ documentation:

This property holds the default window icon

Access functions:

QIcon windowIcon()
void setWindowIcon(const QIcon &icon)

See also QWidget::setWindowIcon() and Setting the Application Icon.

pub unsafe fn start_drag_distance() -> c_int[src]

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.

Calls C++ function: static int QApplication::startDragDistance().

C++ documentation:

If you support drag and drop in your application, and want to start a drag and drop operation after the user has moved the cursor a certain distance with a button held down, you should use this property's value as the minimum distance required.

For example, if the mouse position of the click is stored in startPos and the current position (e.g. in the mouse move event) is currentPos, you can find out if a drag should be started with code like this:

int main(int argc, char *argv[]) { QApplication::setDesktopSettingsAware(false); QApplication app(argc, argv); ... return app.exec(); }

Qt uses this value internally, e.g. in QFileDialog.

The default value (if the platform doesn't provide a different default) is 10 pixels.

Access functions:

int startDragDistance()
void setStartDragDistance(int l)

See also startDragTime(), QPoint::manhattanLength(), and Drag and Drop.

pub unsafe fn start_drag_time() -> c_int[src]

This property holds the time in milliseconds that a mouse button must be held down before a drag and drop operation will begin

Calls C++ function: static int QApplication::startDragTime().

C++ documentation:

This property holds the time in milliseconds that a mouse button must be held down before a drag and drop operation will begin

If you support drag and drop in your application, and want to start a drag and drop operation after the user has held down a mouse button for a certain amount of time, you should use this property's value as the delay.

Qt also uses this delay internally, e.g. in QTextEdit and QLineEdit, for starting a drag.

The default value is 500 ms.

Access functions:

int startDragTime()
void setStartDragTime(int ms)

See also startDragDistance() and Drag and Drop.

pub unsafe fn static_meta_object() -> Ref<QMetaObject>[src]

Returns a reference to the staticMetaObject field.

pub unsafe fn style() -> MutPtr<QStyle>[src]

Returns the application's style object.

Calls C++ function: static QStyle* QApplication::style().

C++ documentation:

Returns the application's style object.

See also setStyle() and QStyle.

pub unsafe fn style_sheet(&self) -> CppBox<QString>[src]

This property holds the application style sheet

Calls C++ function: QString QApplication::styleSheet() const.

C++ documentation:

This property holds the application style sheet

By default, this property returns an empty string unless the user specifies the -stylesheet option on the command line when running the application.

This property was introduced in Qt 4.2.

Access functions:

QString styleSheet() const
void setStyleSheet(const QString &sheet)

See also QWidget::setStyle() and Qt Style Sheets.

pub unsafe fn top_level_at_1a(p: impl CastInto<Ref<QPoint>>) -> MutPtr<QWidget>[src]

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

Calls C++ function: static QWidget* QApplication::topLevelAt(const QPoint& p).

C++ documentation:

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

pub unsafe fn top_level_at_2a(x: c_int, y: c_int) -> MutPtr<QWidget>[src]

This is an overloaded function.

Calls C++ function: static QWidget* QApplication::topLevelAt(int x, int y).

C++ documentation:

This is an overloaded function.

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

pub unsafe fn top_level_widgets() -> CppBox<QListOfQWidget>[src]

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

Calls C++ function: static QList<QWidget*> QApplication::topLevelWidgets().

C++ documentation:

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

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

Example:

void showAllHiddenTopLevelWidgets() { foreach (QWidget *widget, QApplication::topLevelWidgets()) { if (widget->isHidden()) widget->show(); } }

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

pub unsafe fn tr(
    s: impl CastInto<Ptr<c_char>>,
    c: impl CastInto<Ptr<c_char>>,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QApplication::tr(const char* s, const char* c, int n).

pub unsafe fn tr_utf8(
    s: impl CastInto<Ptr<c_char>>,
    c: impl CastInto<Ptr<c_char>>,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QApplication::trUtf8(const char* s, const char* c, int n).

pub unsafe fn wheel_scroll_lines() -> c_int[src]

This property holds the number of lines to scroll a widget, when the mouse wheel is rotated.

Calls C++ function: static int QApplication::wheelScrollLines().

C++ documentation:

This property holds the number of lines to scroll a widget, when the mouse wheel is rotated.

If the value exceeds the widget's number of visible lines, the widget should interpret the scroll operation as a single page up or page down. If the widget is an item view class, then the result of scrolling one line depends on the setting of the widget's scroll mode. Scroll one line can mean scroll one item or scroll one pixel.

By default, this property has a value of 3.

Access functions:

int wheelScrollLines()
void setWheelScrollLines(int)

See also QStyleHints::wheelScrollLines().

pub unsafe fn widget_at_1a(p: impl CastInto<Ref<QPoint>>) -> MutPtr<QWidget>[src]

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

Calls C++ function: static QWidget* QApplication::widgetAt(const QPoint& p).

C++ documentation:

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

This function can be slow.

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

pub unsafe fn widget_at_2a(x: c_int, y: c_int) -> MutPtr<QWidget>[src]

This is an overloaded function.

Calls C++ function: static QWidget* QApplication::widgetAt(int x, int y).

C++ documentation:

This is an overloaded function.

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

pub unsafe fn window_icon() -> CppBox<QIcon>[src]

This property holds the default window icon

Calls C++ function: static QIcon QApplication::windowIcon().

C++ documentation:

This property holds the default window icon

Access functions:

QIcon windowIcon()
void setWindowIcon(const QIcon &icon)

See also QWidget::setWindowIcon() and Setting the Application Icon.

Methods from Deref<Target = QGuiApplication>

pub fn font_database_changed(&self) -> Signal<()>[src]

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

Returns a built-in Qt signal QGuiApplication::fontDatabaseChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

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

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

pub fn screen_added(&self) -> Signal<(*mut QScreen,)>[src]

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

Returns a built-in Qt signal QGuiApplication::screenAdded that can be passed to qt_core::Signal::connect.

C++ documentation:

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

See also screens(), primaryScreen, and screenRemoved().

pub fn screen_removed(&self) -> Signal<(*mut QScreen,)>[src]

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

Returns a built-in Qt signal QGuiApplication::screenRemoved that can be passed to qt_core::Signal::connect.

C++ documentation:

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

This function was introduced in Qt 5.4.

See also screens(), screenAdded(), QObject::destroyed(), and QWindow::setScreen().

pub fn primary_screen_changed(&self) -> Signal<(*mut QScreen,)>[src]

This property holds the primary (or default) screen of the application.

Returns a built-in Qt signal QGuiApplication::primaryScreenChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

This property holds the primary (or default) screen of the application.

This will be the screen where QWindows are initially shown, unless otherwise specified.

The primaryScreenChanged signal was introduced in Qt 5.6.

Access functions:

QScreen *primaryScreen()

Notifier signal:

void primaryScreenChanged(QScreen *screen)

See also screens().

pub fn last_window_closed(&self) -> Signal<()>[src]

This signal is emitted from exec() when the last visible primary window (i.e. window with no parent) is closed.

Returns a built-in Qt signal QGuiApplication::lastWindowClosed that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted from exec() when the last visible primary window (i.e. window with no parent) is closed.

By default, QGuiApplication quits after this signal is emitted. This feature can be turned off by setting quitOnLastWindowClosed to false.

See also QWindow::close() and QWindow::isTopLevel().

pub fn focus_object_changed(&self) -> Signal<(*mut QObject,)>[src]

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

Returns a built-in Qt signal QGuiApplication::focusObjectChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

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

See also focusObject().

pub fn focus_window_changed(&self) -> Signal<(*mut QWindow,)>[src]

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

Returns a built-in Qt signal QGuiApplication::focusWindowChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

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

See also focusWindow().

pub fn application_state_changed(&self) -> Signal<(ApplicationState,)>[src]

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

Returns a built-in Qt signal QGuiApplication::applicationStateChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

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

This function was introduced in Qt 5.2.

See also applicationState().

pub fn layout_direction_changed(&self) -> Signal<(LayoutDirection,)>[src]

This property holds the default layout direction for this application

Returns a built-in Qt signal QGuiApplication::layoutDirectionChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

This property holds the default layout direction for this application

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

The notifier signal was introduced in Qt 5.4.

Access functions:

Qt::LayoutDirection layoutDirection()
void setLayoutDirection(Qt::LayoutDirection direction)

Notifier signal:

void layoutDirectionChanged(Qt::LayoutDirection direction)

See also QWidget::layoutDirection, isLeftToRight(), and isRightToLeft().

pub fn commit_data_request(&self) -> Signal<(*mut QSessionManager,)>[src]

This signal deals with session management. It is emitted when the QSessionManager wants the application to commit all its data.

Returns a built-in Qt signal QGuiApplication::commitDataRequest that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal deals with session management. It is emitted when the QSessionManager wants the application to commit all its data.

Usually this means saving all open files, after getting permission from the user. Furthermore you may want to provide a means by which the user can cancel the shutdown.

You should not exit the application within this signal. Instead, the session manager may or may not do this afterwards, depending on the context.

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

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

This function was introduced in Qt 4.2.

See also setFallbackSessionManagementEnabled(), isSessionRestored(), sessionId(), saveStateRequest(), and Session Management.

pub fn save_state_request(&self) -> Signal<(*mut QSessionManager,)>[src]

This signal deals with session management. It is invoked when the session manager wants the application to preserve its state for a future session.

Returns a built-in Qt signal QGuiApplication::saveStateRequest that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal deals with session management. It is invoked when the session manager wants the application to preserve its state for a future session.

For example, a text editor would create a temporary file that includes the current contents of its edit buffers, the location of the cursor and other aspects of the current editing session.

You should never exit the application within this signal. Instead, the session manager may or may not do this afterwards, depending on the context. Futhermore, most session managers will very likely request a saved state immediately after the application has been started. This permits the session manager to learn about the application's restart policy.

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

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

This function was introduced in Qt 4.2.

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

pub fn palette_changed(&self) -> Signal<(*const QPalette,)>[src]

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

Returns a built-in Qt signal QGuiApplication::paletteChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

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

This function was introduced in Qt 5.4.

See also palette().

pub fn application_display_name_changed(&self) -> Signal<()>[src]

This property holds the user-visible name of this application

Returns a built-in Qt signal QGuiApplication::applicationDisplayNameChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

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.

This property was introduced in Qt 5.0.

Access functions:

QString applicationDisplayName()
void setApplicationDisplayName(const QString &name)

Notifier signal:

void applicationDisplayNameChanged()

See also applicationName.

pub unsafe fn device_pixel_ratio(&self) -> f64[src]

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

Calls C++ function: double QGuiApplication::devicePixelRatio() const.

C++ documentation:

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

Use this function only when you don't know which window you are targeting. If you do know the target window, use QWindow::devicePixelRatio() instead.

See also QWindow::devicePixelRatio().

pub unsafe fn is_saving_session(&self) -> bool[src]

Returns true if the application is currently saving the session; otherwise returns false.

Calls C++ function: bool QGuiApplication::isSavingSession() const.

C++ documentation:

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.

This function was introduced in Qt 5.0.

See also sessionId(), commitDataRequest(), and saveStateRequest().

pub unsafe fn is_session_restored(&self) -> bool[src]

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

Calls C++ function: bool QGuiApplication::isSessionRestored() const.

C++ documentation:

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

See also sessionId(), commitDataRequest(), and saveStateRequest().

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QGuiApplication::metaObject() const.

pub unsafe fn notify(
    &mut self,
    arg1: impl CastInto<MutPtr<QObject>>,
    arg2: impl CastInto<MutPtr<QEvent>>
) -> bool
[src]

Reimplemented from QCoreApplication::notify().

Calls C++ function: virtual bool QGuiApplication::notify(QObject* arg1, QEvent* arg2).

C++ documentation:

Reimplemented from QCoreApplication::notify().

pub unsafe fn qt_metacall(
    &mut self,
    arg1: Call,
    arg2: i32,
    arg3: impl CastInto<MutPtr<*mut c_void>>
) -> i32
[src]

Calls C++ function: virtual int QGuiApplication::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(
    &mut self,
    arg1: impl CastInto<Ptr<i8>>
) -> MutPtr<c_void>
[src]

Calls C++ function: virtual void* QGuiApplication::qt_metacast(const char* arg1).

pub unsafe fn session_id(&self) -> CppBox<QString>[src]

Returns the current session's identifier.

Calls C++ function: QString QGuiApplication::sessionId() const.

C++ documentation:

Returns the current session's identifier.

If the application has been restored from an earlier session, this identifier is the same as it was in that previous session. The session identifier is guaranteed to be unique both for different applications and for different instances of the same application.

See also isSessionRestored(), sessionKey(), commitDataRequest(), and saveStateRequest().

pub unsafe fn session_key(&self) -> CppBox<QString>[src]

Returns the session key in the current session.

Calls C++ function: QString QGuiApplication::sessionKey() const.

C++ documentation:

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 every time the session is saved. If the shutdown process is cancelled, another session key will be used when shutting down again.

See also isSessionRestored(), sessionId(), commitDataRequest(), and saveStateRequest().

Trait Implementations

impl CppDeletable for QApplication[src]

unsafe fn delete(&mut self)[src]

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

Calls C++ function: virtual [destructor] void QApplication::~QApplication().

C++ documentation:

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

impl Deref for QApplication[src]

type Target = QGuiApplication

The resulting type after dereferencing.

fn deref(&self) -> &QGuiApplication[src]

Calls C++ function: QGuiApplication* static_cast<QGuiApplication*>(QApplication* ptr).

impl DerefMut for QApplication[src]

fn deref_mut(&mut self) -> &mut QGuiApplication[src]

Calls C++ function: QGuiApplication* static_cast<QGuiApplication*>(QApplication* ptr).

impl DynamicCast<QApplication> for QGuiApplication[src]

unsafe fn dynamic_cast(ptr: Ptr<QGuiApplication>) -> Ptr<QApplication>[src]

Calls C++ function: QApplication* dynamic_cast<QApplication*>(QGuiApplication* ptr).

unsafe fn dynamic_cast_mut(ptr: MutPtr<QGuiApplication>) -> MutPtr<QApplication>[src]

Calls C++ function: QApplication* dynamic_cast<QApplication*>(QGuiApplication* ptr).

impl DynamicCast<QApplication> for QCoreApplication[src]

unsafe fn dynamic_cast(ptr: Ptr<QCoreApplication>) -> Ptr<QApplication>[src]

Calls C++ function: QApplication* dynamic_cast<QApplication*>(QCoreApplication* ptr).

unsafe fn dynamic_cast_mut(
    ptr: MutPtr<QCoreApplication>
) -> MutPtr<QApplication>
[src]

Calls C++ function: QApplication* dynamic_cast<QApplication*>(QCoreApplication* ptr).

impl DynamicCast<QApplication> for QObject[src]

unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QApplication>[src]

Calls C++ function: QApplication* dynamic_cast<QApplication*>(QObject* ptr).

unsafe fn dynamic_cast_mut(ptr: MutPtr<QObject>) -> MutPtr<QApplication>[src]

Calls C++ function: QApplication* dynamic_cast<QApplication*>(QObject* ptr).

impl StaticDowncast<QApplication> for QGuiApplication[src]

unsafe fn static_downcast(ptr: Ptr<QGuiApplication>) -> Ptr<QApplication>[src]

Calls C++ function: QApplication* static_cast<QApplication*>(QGuiApplication* ptr).

unsafe fn static_downcast_mut(
    ptr: MutPtr<QGuiApplication>
) -> MutPtr<QApplication>
[src]

Calls C++ function: QApplication* static_cast<QApplication*>(QGuiApplication* ptr).

impl StaticDowncast<QApplication> for QCoreApplication[src]

unsafe fn static_downcast(ptr: Ptr<QCoreApplication>) -> Ptr<QApplication>[src]

Calls C++ function: QApplication* static_cast<QApplication*>(QCoreApplication* ptr).

unsafe fn static_downcast_mut(
    ptr: MutPtr<QCoreApplication>
) -> MutPtr<QApplication>
[src]

Calls C++ function: QApplication* static_cast<QApplication*>(QCoreApplication* ptr).

impl StaticDowncast<QApplication> for QObject[src]

unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QApplication>[src]

Calls C++ function: QApplication* static_cast<QApplication*>(QObject* ptr).

unsafe fn static_downcast_mut(ptr: MutPtr<QObject>) -> MutPtr<QApplication>[src]

Calls C++ function: QApplication* static_cast<QApplication*>(QObject* ptr).

impl StaticUpcast<QCoreApplication> for QApplication[src]

unsafe fn static_upcast(ptr: Ptr<QApplication>) -> Ptr<QCoreApplication>[src]

Calls C++ function: QCoreApplication* static_cast<QCoreApplication*>(QApplication* ptr).

unsafe fn static_upcast_mut(
    ptr: MutPtr<QApplication>
) -> MutPtr<QCoreApplication>
[src]

Calls C++ function: QCoreApplication* static_cast<QCoreApplication*>(QApplication* ptr).

impl StaticUpcast<QGuiApplication> for QApplication[src]

unsafe fn static_upcast(ptr: Ptr<QApplication>) -> Ptr<QGuiApplication>[src]

Calls C++ function: QGuiApplication* static_cast<QGuiApplication*>(QApplication* ptr).

unsafe fn static_upcast_mut(
    ptr: MutPtr<QApplication>
) -> MutPtr<QGuiApplication>
[src]

Calls C++ function: QGuiApplication* static_cast<QGuiApplication*>(QApplication* ptr).

impl StaticUpcast<QObject> for QApplication[src]

unsafe fn static_upcast(ptr: Ptr<QApplication>) -> Ptr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(QApplication* ptr).

unsafe fn static_upcast_mut(ptr: MutPtr<QApplication>) -> MutPtr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(QApplication* ptr).

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.