$szTitle = "Qt 4.4: QApplication Class Reference"; include "./_header.inc"; ?>
Главная · Все пространства имен · Все классы · Основные классы · Классы по группам · Модули · Функции |
The QApplication class manages the GUI application's control flow and main settings. Далее...
#include <QApplication>
Inherits QCoreApplication.
|
|
The QApplication class manages the GUI application's control flow and main settings.
Он содержит главный цикл обработки событий, где обрабатываются и координируются все события из оконной системы и других источников. It also handles the application's initialization and finalization, and provides session management. It also handles most system-wide and application-wide settings.
For any GUI application that uses Qt, there is precisely one QApplication object, no matter whether the application has 0, 1, 2 or more windows at any time. For non-GUI Qt applications, use QCoreApplication instead, which doesn't depend on the QtGui library.
The QApplication object is accessible through the instance() function which return a pointer equivalent to the global qApp pointer.
QApplication's main areas of responsibility are:
Since the QApplication object does so much initialization, it must be created before any other objects related to the user interface are created.
Since it also deals with common command line arguments, it is usually a good idea to create it before any interpretation or modification of argv is done in the application itself.
See also QCoreApplication, QAbstractEventDispatcher, QEventLoop, and QSettings.
Константа | Значение | Описание |
---|---|---|
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 |
See setColorSpec() for full details.
Константа | Значение | Описание |
---|---|---|
QApplication::Tty | 0 | a console application |
QApplication::GuiClient | 1 | a GUI client application |
QApplication::GuiServer | 2 | a GUI server application (for Qt for Embedded Linux) |
This property defines a threshold for auto maximizing widgets.
The auto maximize threshold is only available as part of Qt for Windows CE.
This property defines a threshold for the size of a window as a percentage of the screen size. If the minimum size hint of a window exceeds the threshold, calling show() will then cause the window to be maximized automatically.
Setting the threshold to be 100 or greater means that it will cause it to always be maximized. Setting it to be 50 means that the widget is maximized if the vertical minimum size hint is at least 50% of the vertical screen size.
If -1 is specified then this will disable the feature.
On Windows CE the default is -1 (i.e. it is disabled). On Windows Mobile the default is 40.
Это свойство было введено в Qt 4.4.
Функции доступа:
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. Widgets should not cache this value since it may be changed at any time by the user changing the global desktop settings.
Note that on Microsoft Windows, setting this property sets the cursor flash time for all applications.
Функции доступа:
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 X, the operating system's value is used.
On Microsoft Windows, calling this function sets the double click interval for all applications.
Функции доступа:
This property holds the minimum size that any GUI element that the user can interact with should have.
For example, no button should be resized to be smaller than the global strut size. The strut size should be considered when reimplementing GUI controls that may be used on touch-screens or similar I/O devices.
Пример:
QSize MyWidget::sizeHint() const { return QSize(80, 25).expandedTo(QApplication::globalStrut()); }
By default, this property contains a QSize object with zero width and height.
Функции доступа:
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 X, the operating system's value is used.
Это свойство было введено в Qt 4.2.
Функции доступа:
This property holds the default layout direction for this application.
On system start-up, the default layout direction depends on the application's language.
Функции доступа:
See also QWidget::layoutDirection, isLeftToRight(), and isRightToLeft().
This property holds whether the application implicitly quits when the last window is closed.
Значение по умолчанию - true.
If this property is true, the applications quits when the last visible primary window (i.e. window with no parent) with the Qt::WA_QuitOnClose attribute set is closed. By default this attribute is set for all widgets except for sub-windows. Refer to Qt::WindowType for a detailed list of Qt::Window objects.
Функции доступа:
See also quit() and QWidget::close().
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:
if ((startPos - currentPos).manhattanLength() >= QApplication::startDragDistance()) startTheDrag();
Qt uses this value internally, e.g. in QFileDialog.
The default value is 4 pixels.
Функции доступа:
See also startDragTime(), QPoint::manhattanLength(), and Drag and Drop.
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.
Функции доступа:
See also startDragDistance() and Drag and Drop.
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.
Это свойство было введено в Qt 4.2.
Функции доступа:
See also QWidget::setStyle() and Qt Style Sheets.
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.
Функции доступа:
This property holds the default window icon.
Функции доступа:
See also QWidget::setWindowIcon() and Setting the Application Icon.
Initializes the window system and constructs an application object with argc command line arguments in argv.
Warning: The data pointed to by argc and argv must stay valid for the entire lifetime of the QApplication object.
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 that argc and argv might be changed. Qt removes command line arguments that it recognizes.
Qt debugging options (not available if Qt was compiled without the QT_DEBUG flag defined):
See Debugging Techniques for a more detailed explanation.
All Qt programs automatically support the following command line options:
The Windows version of Qt also support one additional command line option, if Direct3D support has been compiled into Qt:
The X11 version of Qt also supports some traditional X11 command line options:
See also arguments().
Constructs an application object with argc command line arguments in argv. If GUIenabled is true, a GUI application is constructed, otherwise a non-GUI (console) application is created.
Set GUIenabled to false for programs without a graphical user interface that should be able to run without a window system.
On X11, the window system is initialized if GUIenabled is true. If GUIenabled is false, the application does not connect to the X server. On Windows and Macintosh, currently the window system is always initialized, regardless of the value of GUIenabled. This may change in future versions of Qt.
The following example shows how to create an application that uses a graphical interface when available.
int main(int argc, char **argv) { #ifdef Q_WS_X11 bool useGUI = getenv("DISPLAY") != 0; #else bool useGUI = true; #endif QApplication app(argc, argv, useGUI); if (useGUI) { // start GUI version ... } else { // start non-GUI version ... } return app.exec(); }
Constructs an application object with argc command line arguments in argv.
With Qt for Embedded Linux, passing QApplication::GuiServer for type makes this application the server (equivalent to running with the -qws option).
Create an application, given an already open display display. If visual and colormap are non-zero, the application will use those as the default Visual and Colormap contexts.
Warning: Qt only supports TrueColor visuals at depths higher than 8 bits-per-pixel.
This is available only on X11.
Create an application, given an already open display and using argc command line arguments in argv. If visual and colormap are non-zero, the application will use those as the default Visual and Colormap contexts.
Warning: Qt only supports TrueColor visuals at depths higher than 8 bits-per-pixel.
This is available only on X11.
Cleans up any window system resources that were allocated by this application. Sets the global variable qApp to 0.
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().
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().
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().
Returns the application top-level window that has the keyboard input focus, or 0 if no application window has the focus. Note that 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().
Causes an alert to be shown for widget if the window is not the active window. The alert is shown for msec miliseconds. If msec is zero (the default), then the alert is shown indefinitely until the window becomes active again.
Currently this function does nothing on Qt for Embedded Linux.
On Mac OS X, this works more at the application level and will cause the application icon to bounce in the dock.
On Windows this causes the window's taskbar entry to flash for a time. If msec is zero, the flashing will stop and the taskbar entry will turn a different color (currently orange).
On X11, this will cause the window to be marked as "demands attention", the window must not be hidden (i.e. not have hide() called on it, but be visible in some sort of way) in order for this to work.
Эта функция была введена в Qt 4.3.
Returns a list of all the widgets in the application.
The list is empty (QList::isEmpty()) if there are no widgets.
Note that some of the widgets may be hidden.
Пример:
void updateAllWidgets() { foreach (QWidget *widget, QApplication::allWidgets()) widget->update(); }
See also topLevelWidgets() and QWidget::isVisible().
Sounds the bell, using the default volume and sound. The function is not available in Qt for Embedded Linux.
Changes the currently active application override cursor to cursor.
This function has no effect if setOverrideCursor() wasn't called.
See also setOverrideCursor(), overrideCursor(), restoreOverrideCursor(), and QWidget::setCursor().
Returns a pointer to the application global clipboard.
Closes all top-level windows.
This function is particularly useful for applications with many top-level windows. It could, for example, be connected to a Exit entry in the File menu:
exitAct = new QAction(tr("E&xit"), this); exitAct->setShortcut(tr("Ctrl+Q")); exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
The windows are closed in random order, until one window does not accept the close event. The application quits when the last window was successfully closed; this can be turned off by setting quitOnLastWindowClosed to false.
See also quitOnLastWindowClosed, lastWindowClosed(), QWidget::close(), QWidget::closeEvent(), lastWindowClosed(), quit(), topLevelWidgets(), and QWidget::isWindow().
Returns the color specification.
See also QApplication::setColorSpec().
This function deals with session management. It is invoked when the QSessionManager wants the application to commit all its data.
Usually this means saving all open files, after getting permission from the user. Furthermore you may want to provide a means by which the user can cancel the shutdown.
Note that you should not exit the application within this function. Instead, the session manager may or may not do this afterwards, depending on the context.
Warning: Within this function, no user interaction is possible, unless you ask the manager for explicit permission. See QSessionManager::allowsInteraction() and QSessionManager::allowsErrorInteraction() for details and example usage.
The default implementation requests interaction and sends a close event to all visible top-level widgets. If any event was rejected, the shutdown is canceled.
See also isSessionRestored(), sessionId(), saveState(), and Session Management.
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.
Note that you should not exit the application when called. 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.
Эта функция была введена в Qt 4.2.
See also isSessionRestored(), sessionId(), saveState(), and Session Management.
Returns the desktop widget (also called the root window).
Note that 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.
Returns true if Qt is set to use the system's standard colors, fonts, etc.; otherwise returns false. Значение по умолчанию - true.
See also setDesktopSettingsAware().
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 speaking, 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().
See also quitOnLastWindowClosed, quit(), exit(), processEvents(), and QCoreApplication::exec().
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. Note that both old and now can be the null-pointer.
The signal is emitted after both widget have been notified about the change through QFocusEvent.
Эта функция была введена в Qt 4.1.
See also QWidget::setFocus(), QWidget::clearFocus(), and Qt::FocusReason.
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().
Returns the default application font.
See also setFont(), fontMetrics(), and QWidget::font().
Это перегруженная функция, предоставленная для удобства.
Returns the default font for the widget.
See also fontMetrics() and QWidget::setFont().
Это перегруженная функция, предоставленная для удобства.
Returns the font for widgets of the given className.
See also setFont() and QWidget::font().
Returns display (screen) font metrics for the application font.
See also font(), setFont(), QWidget::fontMetrics(), and QPainter::fontMetrics().
Returns the QInputContext instance used by the application.
Смотрите также setInputContext().
Returns true if effect is enabled; otherwise returns false.
By default, Qt will try to use the desktop settings. Call setDesktopSettingsAware(false) to prevent this.
Note: All effects are disabled on screens running at less than 16-bit color depth.
See also setEffectEnabled() and Qt::UIEffect.
Returns true if the application's layout direction is Qt::LeftToRight; otherwise returns false.
See also layoutDirection() and isRightToLeft().
Returns true if the application's layout direction is Qt::RightToLeft; otherwise returns false.
See also layoutDirection() and isLeftToRight().
Returns true if the application has been restored from an earlier session; otherwise returns false.
See also sessionId(), commitData(), and saveState().
Returns the current keyboard input direction.
Эта функция была введена в Qt 4.2.
Returns the current keyboard input locale.
Эта функция была введена в Qt 4.2.
Returns the current state of the modifier keys on the keyboard. The current state is updated sychronously as the event queue is emptied of events that will spontaneously change the keyboard state (QEvent::KeyPress and QEvent::KeyRelease events).
It should be noted this may not reflect the actual keys held on the input device at the time of calling but rather the modifiers as last reported in one of the above events. If no keys are being held Qt::NoModifier is returned.
See also mouseButtons().
Returns true if Qt is set to use keypad navigation; otherwise returns false. По умолчанию равно false.
This feature is only available in Qt for Embedded Linux.
See also setKeypadNavigationEnabled().
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 be turned off by setting quitOnLastWindowClosed to false.
See also QWidget::close().
Warning: This virtual function is only implemented under Mac OS X.
If you create an application that inherits QApplication and reimplement this function, you get direct access to all Carbon Events that are received from Mac OS X with this function being called with the caller and the event.
Return true if you want to stop the event from being processed. Return false for normal event dispatching. The default implementation returns false.
Returns the current state of the buttons on the mouse. The current state is updated syncronously as the event queue is emptied of events that will spontaneously change the mouse state (QEvent::MousePress and QEvent::MouseRelease events).
It should be noted this may not reflect the actual buttons held on theinput device at the time of calling but rather the mouse buttons as last reported in one of the above events. If no mouse buttons are being held Qt::NoButton is returned.
See also keyboardModifiers().
Returns the active application override cursor.
This function returns 0 if no application cursor has been defined (i.e. the internal cursor stack is empty).
See also setOverrideCursor() and restoreOverrideCursor().
Returns the application palette.
See also setPalette() and QWidget::palette().
Это перегруженная функция, предоставленная для удобства.
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 isn't a 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().
Это перегруженная функция, предоставленная для удобства.
Returns the palette for widgets of the given className.
See also setPalette() and QWidget::palette().
Это перегруженная функция, предоставленная для удобства.
Undoes the last setOverrideCursor().
If setOverrideCursor() has been called twice, calling restoreOverrideCursor() will activate the first cursor set. Calling this function a second time restores the original widgets' cursors.
See also setOverrideCursor() and overrideCursor().
This function deals with session management. It is invoked when the session manager wants the application to preserve its state for a future session.
For example, a text editor would create a temporary file that includes the current contents of its edit buffers, the location of the cursor and other aspects of the current editing session.
Note that you should never exit the application within this function. Instead, the session manager may or may not do this afterwards, depending on the context. Futhermore, most session managers will very likely request a saved state immediately after the application has been started. This permits the session manager to learn about the application's restart policy.
Warning: Within this function, no user interaction is possible, unless you ask the manager for explicit permission. See QSessionManager::allowsInteraction() and QSessionManager::allowsErrorInteraction() for details.
See also isSessionRestored(), sessionId(), commitData(), and Session Management.
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.
Note that you should never exit the application within this signal. Instead, the session manager may or may not do this afterwards, depending on the context. Futhermore, most session managers will very likely request a saved state immediately after the application has been started. This permits the session manager to learn about the application's restart policy.
Warning: Within this function, no user interaction is possible, unless you ask the manager for explicit permission. See QSessionManager::allowsInteraction() and QSessionManager::allowsErrorInteraction() for details.
Note:: You should use Qt::DirectConnection when connecting to this signal.
Эта функция была введена в Qt 4.2.
See also isSessionRestored(), sessionId(), commitData(), and Session Management.
Returns the current session's identifier.
If the application has been restored from an earlier session, this identifier is the same as it was in that previous session.
The session identifier is guaranteed to be unique both for different applications and for different instances of the same application.
See also isSessionRestored(), sessionKey(), commitData(), and saveState().
Returns the session key in the current session.
If the application has been restored from an earlier session, this key is the same as it was when the previous session ended.
The session key changes with every call of commitData() or saveState().
See also isSessionRestored(), sessionId(), commitData(), and saveState().
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().
Sets the color specification for the application to spec.
The color specification controls how the application allocates colors when run on a display with a limited amount of colors, e.g. 8 bit / 256 color displays.
The color specification must be set before you create the QApplication object.
The options are:
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.
Пример:
int main(int argc, char *argv[]) { QApplication::setColorSpec(QApplication::ManyColor); QApplication app(argc, argv); ... return app.exec(); }
See also colorSpec().
Sets whether Qt should use the system's standard colors, fonts, etc., to on. By default, this is true.
This function must be called before creating the QApplication object, like this:
int main(int argc, char *argv[]) { QApplication::setDesktopSettingsAware(false); QApplication app(argc, argv); ... return app.exec(); }
See also desktopSettingsAware().
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().
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().
This function replaces the QInputContext instance used by the application with inputContext.
Смотрите также inputContext().
Sets whether Qt should use focus navigation suitable for use with a minimal keypad.
If enable is true, Qt::Key_Up and Qt::Key_Down are used to change focus.
This feature is only available in Qt for Embedded Linux.
See also keypadNavigationEnabled().
Sets the application override cursor to cursor.
Application override cursors are intended for showing the user that the application is in a special state, for example during an operation that might take some time.
This cursor will be displayed in all the application's widgets until restoreOverrideCursor() or another setOverrideCursor() is called.
Application cursors are stored on an internal stack. setOverrideCursor() pushes the cursor onto the stack, and restoreOverrideCursor() pops the active cursor off the stack. changeOverrideCursor() changes the curently active application override cursor. Every setOverrideCursor() must eventually be followed by a corresponding restoreOverrideCursor(), otherwise the stack will never be emptied.
Пример:
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
calculateHugeMandelbrot(); // lunch time...
QApplication::restoreOverrideCursor();
See also overrideCursor(), restoreOverrideCursor(), changeOverrideCursor(), and QWidget::setCursor().
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. Когда используются таблицы стилей, палитра виджета может установить "цвет" (color), "цвет фона" (background-color), "цвет выделения" (selection-color), "цвет выделенного фона" (selection-background-color) и "дополнительный цвет фона" (alternate-background-color).
Note that some styles do not use the palette for all drawing, for instance, if they make use of native theme engines. This is the case for the Windows XP, Windows Vista, and Mac OS X styles.
See also QWidget::setPalette(), palette(), and QStyle::polish().
Sets the application's GUI style to style. Ownership of the style object is transferred to QApplication, so QApplication will delete the style object on application exit or when a new style is set and the old style is still the parent of the application object.
Example usage:
QApplication::setStyle(new QWindowsStyle);
When switching application styles, the color palette is set back to the initial colors or the system defaults. This is necessary since certain styles have to adapt the color palette to be fully style-guide compliant.
Note that 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.
Предупреждение: Таблицы стилей Qt в настоящее время не поддерживаются для пользовательских подклассов QStyle. Мы планируем вернуться к этому в одном из следующих релизов.
See also style(), QStyle, setPalette(), and desktopSettingsAware().
Это перегруженная функция, предоставленная для удобства.
Requests a QStyle object for style from the QStyleFactory.
The string must be one of the QStyleFactory::keys(), typically one of "windows", "motif", "cde", "plastique", "windowsxp", or "macintosh". Style names are case insensitive.
Returns 0 if an unknown style is passed, otherwise the QStyle object returned is set as the application's GUI style.
Warning: To ensure that the application's style is set correctly, it is best to call this function before the QApplication constructor, if possible.
Returns the application's style object.
See also setStyle() and QStyle.
Synchronizes with the X server in the X11 implementation. This normally takes some time. Does nothing on other platforms.
Returns the top-level widget at the given point; returns 0 if there is no such widget.
Это перегруженная функция, предоставленная для удобства.
Returns the top-level widget at the point (x, y); returns 0 if there is no such widget.
Returns a list of the top-level widgets (windows) in the application.
Note that some of the top-level widgets may be hidden, for example a tooltip if no tooltip is currently shown.
Пример:
void showAllHiddenTopLevelWidgets() { foreach (QWidget *widget, QApplication::topLevelWidgets()) { if (widget->isHidden()) widget->show(); } }
See also allWidgets(), QWidget::isWindow(), and QWidget::isHidden().
Returns the type of application (Tty, GuiClient, or GuiServer). The type is set when constructing the QApplication object.
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().
Это перегруженная функция, предоставленная для удобства.
Returns the widget at global screen position (x, y), or 0 if there is no Qt widget there.
Warning: This virtual function is only implemented under X11.
If you create an application that inherits QApplication and reimplement this function, you get direct access to all X events that the are received from the X server. The events are passed in the event parameter.
Return true if you want to stop the event from being processed. Return false for normal event dispatching. The default implementation returns false.
It is only the directly addressed messages that are filtered. You must install an event filter directly on the event dispatcher, which is returned by QAbstractEventDispatcher::instance(), to handle system wide messages.
See also x11ProcessEvent().
This function does the core processing of individual X events, normally by dispatching Qt events to the right destination.
It returns 1 if the event was consumed by special handling, 0 if the event was consumed by normal handling, and -1 if the event was for an unrecognized widget.
See also x11EventFilter().
A global pointer referring to the unique application object. It is equivalent to the pointer returned by the QCoreApplication::instance() function except that, in GUI applications, it is a pointer to a QApplication instance.
Only one application object can be created.
See also QCoreApplication::instance().
Copyright © 2008 Nokia | Торговые марки | Qt 4.4.3 |