<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # QApplication Class Reference ## [[QtGui](index.htm) module] 該的QApplication類管理圖形用戶界面應用程序的控制流和主要設置。[More...](#details) 繼承[QCoreApplication](qcoreapplication.html)。 ### Types * `enum ColorSpec { NormalColor, CustomColor, ManyColor }` * `enum Type { Tty, GuiClient, GuiServer }` ### Methods * `__init__ (self, list-of-str?argv)` * `__init__ (self, list-of-str?argv, bool?GUIenabled)` * `__init__ (self, list-of-str?argv, Type)` * `__init__ (self, Display?display, int?visual?=?0, int?colormap?=?0)` * `__init__ (self, Display?dpy, list-of-str?argv, int?visual?=?0, int?cmap?=?0)` * `bool autoSipEnabled (self)` * `commitData (self, QSessionManager?sm)` * `bool event (self, QEvent)` * `QInputContext inputContext (self)` * `bool isSessionRestored (self)` * `bool notify (self, QObject, QEvent)` * `saveState (self, QSessionManager?sm)` * `QString sessionId (self)` * `QString sessionKey (self)` * `setAutoSipEnabled (self, bool?enabled)` * `setInputContext (self, QInputContext)` * `setStyleSheet (self, QString?sheet)` * `QString styleSheet (self)` * `bool x11EventFilter (self, sip.voidptr)` * `int x11ProcessEvent (self, sip.voidptr)` ### Static Methods * `aboutQt ()` * `QWidget activeModalWidget ()` * `QWidget activePopupWidget ()` * `QWidget activeWindow ()` * `alert (QWidget?widget, int?msecs?=?0)` * `list-of-QWidget allWidgets ()` * `beep ()` * `changeOverrideCursor (QCursor)` * `QClipboard clipboard ()` * `closeAllWindows ()` * `int colorSpec ()` * `int cursorFlashTime ()` * `QDesktopWidget desktop ()` * `bool desktopSettingsAware ()` * `int doubleClickInterval ()` * `int exec_ ()` * `QWidget focusWidget ()` * `QFont font ()` * `QFont font (QWidget)` * `QFont font (str?className)` * `QFontMetrics fontMetrics ()` * `QSize globalStrut ()` * `bool isEffectEnabled (Qt.UIEffect)` * `bool isLeftToRight ()` * `bool isRightToLeft ()` * `Qt.LayoutDirection keyboardInputDirection ()` * `int keyboardInputInterval ()` * `QLocale keyboardInputLocale ()` * `Qt.KeyboardModifiers keyboardModifiers ()` * `Qt.LayoutDirection layoutDirection ()` * `Qt.MouseButtons mouseButtons ()` * `QCursor overrideCursor ()` * `QPalette palette ()` * `QPalette palette (QWidget)` * `QPalette palette (str?className)` * `Qt.KeyboardModifiers queryKeyboardModifiers ()` * `bool quitOnLastWindowClosed ()` * `restoreOverrideCursor ()` * `setActiveWindow (QWidget?act)` * `setColorSpec (int)` * `setCursorFlashTime (int)` * `setDesktopSettingsAware (bool)` * `setDoubleClickInterval (int)` * `setEffectEnabled (Qt.UIEffect?effect, bool?enabled?=?True)` * `setFont (QFont?font, str?className?=?None)` * `setGlobalStrut (QSize)` * `setGraphicsSystem (QString)` * `setKeyboardInputInterval (int)` * `setLayoutDirection (Qt.LayoutDirection?direction)` * `setOverrideCursor (QCursor)` * `setPalette (QPalette?palette, str?className?=?None)` * `setQuitOnLastWindowClosed (bool?quit)` * `setStartDragDistance (int?l)` * `setStartDragTime (int?ms)` * `setStyle (QStyle)` * `QStyle setStyle (QString)` * `setWheelScrollLines (int)` * `setWindowIcon (QIcon?icon)` * `int startDragDistance ()` * `int startDragTime ()` * `QStyle style ()` * `syncX ()` * `QWidget topLevelAt (QPoint?p)` * `QWidget topLevelAt (int?x, int?y)` * `list-of-QWidget topLevelWidgets ()` * `Type type ()` * `int wheelScrollLines ()` * `QWidget widgetAt (QPoint?p)` * `QWidget widgetAt (int?x, int?y)` * `QIcon windowIcon ()` ### Qt Signals * `void commitDataRequest (QSessionManager&)` * `void focusChanged (QWidget *,QWidget *)` * `void fontDatabaseChanged ()` * `void lastWindowClosed ()` * `void saveStateRequest (QSessionManager&)` * * * ## Detailed Description 該的QApplication類管理圖形用戶界面應用程序的控制流和主要設置。 的QApplication包含主事件循環,其中來自窗口系統和其他來源的所有事件被處理和調度。它也處理應用程序的初始化,最后定稿,并提供會話管理。此外,的QApplication處理大部分的系統范圍和應用范圍的設置。 對于使用Qt的任何GUI應用程序,有正**one**QApplication對象,無論應用程序是否具有0 ,1,2或更多個窗口在任何給定時間。對于非GUI Qt應用程序,使用[QCoreApplication](qcoreapplication.html)相反,因為它不依賴于[QtGui](index.htm)庫。 QApplication對象是通過訪問[instance](qcoreapplication.html#instance)( )函數返回一個指針相當于全球[qApp](index.htm#qApp-var)指針。 的QApplication的主要責任領域是: * It initializes the application with the user's desktop settings such as [palette](qapplication.html#palette)(), [font](qapplication.html#font)() and [doubleClickInterval](qapplication.html#doubleClickInterval-prop)(). 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](qcoreapplication.html#sendEvent)() and [postEvent](qcoreapplication.html#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](qapplication.html#QApplication) below for more details. * It defines the application's look and feel, which is encapsulated in a [QStyle](qstyle.html) object. This can be changed at runtime with [setStyle](qapplication.html#setStyle)(). * It specifies how the application is to allocate colors. See [setColorSpec](qapplication.html#setColorSpec)() for details. * It provides localization of strings that are visible to the user via [translate](qcoreapplication.html#translate)(). * It provides some magical objects like the [desktop](qapplication.html#desktop)() and the [clipboard](qapplication.html#clipboard)(). * It knows about the application's windows. You can ask which widget is at a certain position using [widgetAt](qapplication.html#widgetAt)(), get a list of [topLevelWidgets](qapplication.html#topLevelWidgets)() and [closeAllWindows](qapplication.html#closeAllWindows)(), etc. * It manages the application's mouse cursor handling, see [setOverrideCursor](qapplication.html#setOverrideCursor)() * On the X window system, it provides functions to flush and sync the communication stream, see [flushX](index.htm#flushX)() and [syncX](qapplication.html#syncX)(). * It provides support for sophisticated [session management](index.htm). This makes it possible for applications to terminate gracefully when the user logs out, to cancel a shutdown process if termination isn't possible and even to preserve the entire application's state for a future session. See [isSessionRestored](qapplication.html#isSessionRestored)(), [sessionId](qapplication.html#sessionId)() and [commitData](qapplication.html#commitData)() and [saveState](qapplication.html#saveState)() for details. 由于QApplication對象做了如此多的初始化,它_must_創建與用戶界面的任何其他對象之前被創建。的QApplication也處理命令行參數。因此,它通常是一個好主意來創建它_before_任何解釋或修改`argv`在該應用程序本身就完成了。 | Groups of functions | | --- | | System settings | [desktopSettingsAware](qapplication.html#desktopSettingsAware)(), [setDesktopSettingsAware](qapplication.html#setDesktopSettingsAware)(), [cursorFlashTime](qapplication.html#cursorFlashTime-prop)(), [setCursorFlashTime](qapplication.html#cursorFlashTime-prop)(), [doubleClickInterval](qapplication.html#doubleClickInterval-prop)(), [setDoubleClickInterval](qapplication.html#doubleClickInterval-prop)(), [setKeyboardInputInterval](qapplication.html#keyboardInputInterval-prop)(), [wheelScrollLines](qapplication.html#wheelScrollLines-prop)(), [setWheelScrollLines](qapplication.html#wheelScrollLines-prop)(), [palette](qapplication.html#palette)(), [setPalette](qapplication.html#setPalette)(), [font](qapplication.html#font)(), [setFont](qapplication.html#setFont)(), [fontMetrics](qapplication.html#fontMetrics)(). | | Event handling | [exec_](qapplication.html#exec)(), [processEvents](qcoreapplication.html#processEvents)(), [exit](qcoreapplication.html#exit)(), [quit](qcoreapplication.html#quit)(). [sendEvent](qcoreapplication.html#sendEvent)(), [postEvent](qcoreapplication.html#postEvent)(), [sendPostedEvents](qcoreapplication.html#sendPostedEvents)(), [removePostedEvents](qcoreapplication.html#removePostedEvents)(), [hasPendingEvents](qcoreapplication.html#hasPendingEvents)(), [notify](qapplication.html#notify)(), [macEventFilter](qapplication.html#macEventFilter)(), [qwsEventFilter](qapplication.html#qwsEventFilter)(), [x11EventFilter](qapplication.html#x11EventFilter)(), [x11ProcessEvent](qapplication.html#x11ProcessEvent)(), [winEventFilter](qcoreapplication.html#winEventFilter)(). | | GUI Styles | [style](qapplication.html#style)(), [setStyle](qapplication.html#setStyle)(). | | Color usage | [colorSpec](qapplication.html#colorSpec)(), [setColorSpec](qapplication.html#setColorSpec)(), [qwsSetCustomColors](qapplication.html#qwsSetCustomColors)(). | | Text handling | [installTranslator](qcoreapplication.html#installTranslator)(), [removeTranslator](qcoreapplication.html#removeTranslator)() [translate](qcoreapplication.html#translate)(). | | Widgets | [allWidgets](qapplication.html#allWidgets)(), [topLevelWidgets](qapplication.html#topLevelWidgets)(), [desktop](qapplication.html#desktop)(), [activePopupWidget](qapplication.html#activePopupWidget)(), [activeModalWidget](qapplication.html#activeModalWidget)(), [clipboard](qapplication.html#clipboard)(), [focusWidget](qapplication.html#focusWidget)(), [activeWindow](qapplication.html#activeWindow)(), [widgetAt](qapplication.html#widgetAt)(). | | Advanced cursor handling | [overrideCursor](qapplication.html#overrideCursor)(), [setOverrideCursor](qapplication.html#setOverrideCursor)(), [restoreOverrideCursor](qapplication.html#restoreOverrideCursor)(). | | X Window System synchronization | [flushX](index.htm#flushX)(), [syncX](qapplication.html#syncX)(). | | Session management | [isSessionRestored](qapplication.html#isSessionRestored)(), [sessionId](qapplication.html#sessionId)(), [commitData](qapplication.html#commitData)(), [saveState](qapplication.html#saveState)(). | | Miscellaneous | [closeAllWindows](qapplication.html#closeAllWindows)(), [startingUp](qcoreapplication.html#startingUp)(), [closingDown](qcoreapplication.html#closingDown)(), [type](qapplication.html#type)(). | * * * ## Type Documentation ``` QApplication.ColorSpec ``` | Constant | Value | Description | | --- | --- | --- | | `QApplication.NormalColor` | `0` | 默認的顏色分配策略 | | `QApplication.CustomColor` | `1` | NormalColor一樣的X11 ,在Windows下需要一個調色板顏色分配 | | `QApplication.ManyColor` | `2` | 對于使用上千種顏色的應用的理想選擇 | See [setColorSpec](qapplication.html#setColorSpec)( )的全部細節。 ``` QApplication.Type ``` | Constant | Value | Description | | --- | --- | --- | | `QApplication.Tty` | `0` | 一個控制臺應用程序 | | `QApplication.GuiClient` | `1` | 一個GUI客戶端應用程序 | | `QApplication.GuiServer` | `2` | 一個GUI服務器應用程序( Qt嵌入式Linux的) | * * * ## Method Documentation ``` QApplication.__init__ (self, list-of-str?argv) ``` 初始化窗口系統,并構造一個應用程序對象_argc_在命令行參數_argv_。 **Warning:**由所述資料_argc_和_argv_必須保持有效的整個生命周期[QApplication](qapplication.html)對象。另外,_argc_必須大于零和_argv_必須至少包含一個有效的字符串。 全球`qApp`指針指到這個應用程序對象。只有一個應用程序對象應該被創建。 此應用程序對象必須在任何構造[paint devices](qpaintdevice.html)(包括窗口小部件,像素圖,位圖等)。 **Note:** _argc_和_argv_作為Qt的刪除,它承認命令行參數可能會改變。 Qt的調試選項(如果Qt未經定義的QT_DEBUG標志編譯) : * -nograb, tells Qt that it must never grab the mouse or the keyboard. * -dograb (only under X11), running under a debugger can cause an implicit -nograb, use -dograb to override. * -sync (only under X11), switches to synchronous mode for debugging. See [Debugging Techniques](index.htm)對于更詳細的解釋。 所有Qt程序自動支持以下命令行選項: * -style= _style_, sets the application GUI style. Possible values are `motif`, `windows`, and `platinum`. If you compiled Qt with additional styles or have additional styles as plugins these will be available to the `-style` command line option. * -style _style_, is the same as listed above. * -stylesheet= _stylesheet_, sets the application [styleSheet](qapplication.html#styleSheet-prop). 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. * -session= _session_, restores the application from an earlier [session](index.htm). * -session _session_, 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](qt.html#LayoutDirection-enum) * -graphicssystem, sets the backend to be used for on-screen widgets and QPixmaps. Available options are `raster` and `opengl`. * -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. 在X11版本的Qt支持一些傳統的X11命令行選項: * -display _display_, sets the X display (default is $DISPLAY). * -geometry _geometry_, sets the client geometry of the first window that is shown. * -fn or `-font` _font_, defines the application font. The font should be specified using an X logical font description. Note that this option is ignored when Qt is built with fontconfig support enabled. * -bg or `-background` _color_, sets the default background color and an application palette (light and dark shades are calculated). * -fg or `-foreground` _color_, sets the default foreground color. * -btn or `-button` _color_, sets the default button color. * -name _name_, sets the application name. * -title _title_, sets the application title. * -visual `TrueColor`, forces the application to use a TrueColor visual on an 8-bit display. * -ncols _count_, limits the number of colors allocated in the color cube on an 8-bit display, if the application is using the [QApplication.ManyColor](qapplication.html#ColorSpec-enum) color specification. If _count_ is 216 then a 6x6x6 color cube is used (i.e. 6 levels of red, 6 of green, and 6 of blue); for other values, a cube approximately proportional to a 2x3x1 cube is used. * -cmap, causes the application to install a private color map on an 8-bit display. * -im, sets the input method server (equivalent to setting the XMODIFIERS environment variable) * -inputstyle, defines how the input is inserted into the given widget, e.g., `onTheSpot` makes the input appear directly in the widget, while `overTheSpot` makes the input appear in a box floating over the widget and is not inserted until the editing is done. #### X11 Notes If [QApplication](qapplication.html)無法打開X11顯示,它會終止進程。此行為與大多數X11應用程序是一致的。 **See also** [arguments](qcoreapplication.html#arguments)( ) 。 ``` QApplication.__init__ (self, list-of-str?argv, bool?GUIenabled) ``` 構造一個應用程序對象_argc_在命令行參數_argv_。如果_GUIenabled_誠然,一個GUI應用程序的構造,否則非圖形用戶界面(控制臺)應用程序創建的。 **Warning:**由所述資料_argc_和_argv_必須保持有效的整個生命周期[QApplication](qapplication.html)對象。另外,_argc_必須大于零和_argv_必須至少包含一個有效的字符串。 集_GUIenabled_為False,不,應該是能夠在沒有窗口系統上運行的圖形用戶界面程序。 在X11中,窗口系統,如果初始化_GUIenabled_是真實的。如果_GUIenabled_是假的,應用程序不連接到X服務器。在Windows和Mac OS ,現在窗口系統總是會被初始化,無論GUIenabled的價值。這可能會改變的Qt的未來版本。 下面的示例顯示了如何創建一個使用圖形界面時,可用的應用程序。 ``` int main(int argc, char **argv) { #ifdef Q_WS_X11 bool useGUI = getenv("DISPLAY") != 0; #else bool useGUI = true; #endif [QApplication](qapplication.html) app(argc, argv, useGUI); if (useGUI) { // start GUI version ... } else { // start non-GUI version ... } return app.exec(); } ``` ``` QApplication.__init__ (self, list-of-str?argv, Type) ``` 構造一個應用程序對象_argc_在命令行參數_argv_。 **Warning:**由所述資料_argc_和_argv_必須保持有效的整個生命周期[QApplication](qapplication.html)對象。另外,_argc_必須大于零和_argv_必須至少包含一個有效的字符串。 與Qt嵌入式Linux的,路過[QApplication.GuiServer](qapplication.html#Type-enum)為_type_這使得應用程序的服務器(相當于與運行`-qws`選項)。 ``` QApplication.__init__ (self, Display?display, int?visual?=?0, int?colormap?=?0) ``` 創建一個應用程序,給定一個已經打開的顯示器_display_。如果_visual_和_colormap_非零,應用程序將使用這些值作為默認的Visual和Colormap上下文。 **Warning:**的Qt只支持TrueColor模式在深度大于8位每像素高。 此功能僅適用于X11 。 ``` QApplication.__init__ (self, Display?dpy, list-of-str?argv, int?visual?=?0, int?cmap?=?0) ``` 創建一個應用程序,給定一個已經打開_display_并使用_argc_在命令行參數_argv_。如果_visual_和_colormap_非零,應用程序將使用這些值作為默認的Visual和Colormap上下文。 **Warning:**的Qt只支持TrueColor模式在深度大于8位每像素高。 此功能僅適用于X11 。 ``` QApplication.aboutQt () ``` 這種方法也是一個Qt槽與C + +的簽名`void aboutQt()`。 顯示關于Qt的一個簡單的消息框。該消息包括對Qt的正在使用的應用程序的版本號。 這是納入有用**Help**一個應用程序的菜單,如圖中[Menus](index.htm)例子。 此函數是一個方便的槽,用于[QMessageBox.aboutQt](qmessagebox.html#aboutQt)( ) 。 ``` QWidget QApplication.activeModalWidget () ``` [ 返回有效的模態窗口小部件。 ](qwidget.html) [模態窗口小部件是一種特殊的頂級窗口部件這是一個子類](qwidget.html)[QDialog](qdialog.html)指定構造函數作為真正的模態參數。模態窗口小部件,必須關閉之前,用戶可以繼續使用該程序的其他部分。 模態窗口部件被組織在一個棧中。該函數返回有效的模態窗口小部件在堆棧的頂部。 **See also** [activePopupWidget](qapplication.html#activePopupWidget)()和[topLevelWidgets](qapplication.html#topLevelWidgets)( ) 。 ``` QWidget QApplication.activePopupWidget () ``` [ 返回激活彈出窗口部件。 ](qwidget.html) [一個彈出窗口部件是一個特殊的頂級窗口部件設置`Qt.WType_Popup`小部件標志,例如該](qwidget.html)[QMenu](qmenu.html)小工具。當應用程序打開一個彈出式窗口小部件,所有事件都發送到彈出。前彈出窗口部件被關閉正常的部件和模態窗口部件不能被訪問。 只有其他彈出窗口部件可以打開一個彈出式窗口小部件時顯示。在彈出的窗口部件被組織在一個棧中。這個函數返回彈出窗口部件在堆棧的頂部。 **See also** [activeModalWidget](qapplication.html#activeModalWidget)()和[topLevelWidgets](qapplication.html#topLevelWidgets)( ) 。 ``` QWidget QApplication.activeWindow () ``` [](qwidget.html) [返回應用程序頂層窗口擁有鍵盤輸入焦點,或者0,如果沒有應用程序窗口具有焦點。有可能是一個則activeWindow ( ),即使沒有](qwidget.html)[focusWidget](qapplication.html#focusWidget)( ) ,例如,如果該窗口沒有窗口部件接收鍵盤事件。 **See also** [setActiveWindow](qapplication.html#setActiveWindow)( )[QWidget.setFocus](qwidget.html#setFocus)( )[QWidget.hasFocus](qwidget.html#focus-prop)()和[focusWidget](qapplication.html#focusWidget)( ) 。 ``` QApplication.alert (QWidget?widget, int?msecs?=?0) ``` 導致警報顯示為_widget_如果窗口不是活動窗口。警報顯示為_msec_毫秒。如果_msec_為0(默認),則顯示警報下去,直到窗口再次變得活躍。 目前,該函數不起作用的Qt嵌入式Linux操作系統。 在Mac OS X上,這個作品更在應用程序級別,并會導致應用程序圖標在Dock上彈跳。 在Windows上,這會導致窗口的任務欄條目閃爍一段時間。如果_msec_是零,那么停止閃爍,并在任務欄條目將變成不同的顏色(目前橙色) 。 在X11 ,這會導致窗口被標記為“需要注意” ,窗口不能被隱藏(即沒有隱藏()調用它,但在某種方式中可見) ,為了這個工作。 此功能被引入Qt的4.3 。 ``` list-of-QWidget QApplication.allWidgets () ``` 返回應用程序的所有窗口部件的列表。 該列表是空的([QList.isEmpty](index.htm#isEmpty)( ) )如果沒有小部件。 **Note:**一些小部件可能會被隱藏。 例如: ``` void updateAllWidgets() { foreach ([QWidget](qwidget.html) *widget, [QApplication](qapplication.html).allWidgets()) widget->update(); } ``` **See also** [topLevelWidgets](qapplication.html#topLevelWidgets)()和[QWidget.isVisible](qwidget.html#visible-prop)( ) 。 ``` bool QApplication.autoSipEnabled (self) ``` ``` QApplication.beep () ``` 聽起來鐘,使用默認音量和聲音。該函數是_not_在現有的Qt嵌入式Linux 。 ``` QApplication.changeOverrideCursor (QCursor) ``` 改變當前激活的應用程序復蓋光標_cursor_。 這個功能有沒有影響,如果[setOverrideCursor](qapplication.html#setOverrideCursor)( )沒有被調用。 **See also** [setOverrideCursor](qapplication.html#setOverrideCursor)( )[overrideCursor](qapplication.html#overrideCursor)( )[restoreOverrideCursor](qapplication.html#restoreOverrideCursor)()和[QWidget.setCursor](qwidget.html#cursor-prop)( ) 。 ``` QClipboard QApplication.clipboard () ``` [ 返回一個指向應用程序的全局剪貼板。 ](qclipboard.html) [**Note:**該](qclipboard.html)[QApplication](qapplication.html)對象應該已經訪問剪貼板之前建造。 ``` QApplication.closeAllWindows () ``` 這種方法也是一個Qt槽與C + +的簽名`void closeAllWindows()`。 關閉所有頂層窗口。 此功能適用于許多頂層窗口的應用程序特別有用。它可以,例如,被連接到一個**Exit**在該條目**File**菜單: ``` exitAct = new [QAction](qaction.html)(tr("E&xit"), this); exitAct->setShortcuts([QKeySequence](qkeysequence.html).Quit); exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); ``` 該窗口都關閉以隨機順序,直到一個窗口不接受close事件。在應用程序退出時,最后一個窗口被成功關閉,這可以通過設置關閉[quitOnLastWindowClosed](qapplication.html#quitOnLastWindowClosed-prop)為False。 **See also** [quitOnLastWindowClosed](qapplication.html#quitOnLastWindowClosed-prop),[lastWindowClosed](qapplication.html#lastWindowClosed)( )[QWidget.close](qwidget.html#close)( )[QWidget.closeEvent](qwidget.html#closeEvent)( )[lastWindowClosed](qapplication.html#lastWindowClosed)( )[quit](qcoreapplication.html#quit)( )[topLevelWidgets](qapplication.html#topLevelWidgets)()和[QWidget.isWindow](qwidget.html#isWindow)( ) 。 ``` int QApplication.colorSpec () ``` 返回顏色規格。 **See also** [QApplication.setColorSpec](qapplication.html#setColorSpec)( ) 。 ``` QApplication.commitData (self, QSessionManager?sm) ``` 這個函數處理[session management](index.htm)。它被調用時,[QSessionManager](qsessionmanager.html)想讓應用程序提交的所有數據。 通常,這意味著保存所有打開的文件,從用戶得到允許后。此外,您可能需要提供由用戶可以取消關機的手段。 你不應該退出這個函數中的應用。相反,會話管理器可以或可以不這樣做之后,這取決于上下文。 **Warning:**在這個函數中,沒有用戶交互是可能的,_unless_你問_manager_為明確許可。看[QSessionManager.allowsInteraction](qsessionmanager.html#allowsInteraction)()和[QSessionManager.allowsErrorInteraction](qsessionmanager.html#allowsErrorInteraction)( )了解詳情和用法示例。 默認實現請求交互和發送一個close事件給所有可見的頂層窗口部件。如果任何一個事件被拒絕,關機將被取消。 **See also** [isSessionRestored](qapplication.html#isSessionRestored)( )[sessionId](qapplication.html#sessionId)( )[saveState](qapplication.html#saveState)()和[Session Management](index.htm)。 ``` int QApplication.cursorFlashTime () ``` ``` QDesktopWidget QApplication.desktop () ``` [ 返回桌面窗口小部件(也稱為根窗口)。 ](qdesktopwidget.html) [桌面可以由多個屏幕,因此它是不正確的,例如,以試圖_center_一些小工具在桌面的幾何形狀。](qdesktopwidget.html)[QDesktopWidget](qdesktopwidget.html)具有各種功能的桌面在獲得有用的幾何形狀,如[QDesktopWidget.screenGeometry](qdesktopwidget.html#screenGeometry)()和[QDesktopWidget.availableGeometry](qdesktopwidget.html#availableGeometry)( ) 。 在X11上,但也可以繪制在桌面上。 ``` bool QApplication.desktopSettingsAware () ``` 返回True如果Qt的設置為使用系統的標準顏色,字體等,否則返回False 。默認值為True 。 **See also** [setDesktopSettingsAware](qapplication.html#setDesktopSettingsAware)( ) 。 ``` int QApplication.doubleClickInterval () ``` ``` bool QApplication.event (self, QEvent) ``` 從重新實現[QObject.event](qobject.html#event)( ) 。 ``` int QApplication.exec_ () ``` 進入主事件循環并等待,直到[exit](qcoreapplication.html#exit)()被調用,然后返回被設置為值[exit](qcoreapplication.html#exit)()(它是0,如果[exit](qcoreapplication.html#exit)( )通過調用[quit](qcoreapplication.html#quit)())。 有必要調用這個函數來啟動事件處理。主事件循環接收事件從窗口系統并調度這些應用程序的部件。 一般情況下,沒有用戶交互可以調用exec ( )之前發生。作為一種特殊的情況下,模式對話框喜歡[QMessageBox](qmessagebox.html)調用exec (之前可以使用) ,因為模式對話框調用exec ( )來啟動一個本地事件循環。 為了使您的應用程序執行閒置處理,即執行一個特殊的功能,每當有沒有掛起的事件,使用[QTimer](qtimer.html)與0超時。更高級的空閒處理方案可以用來實現[processEvents](qcoreapplication.html#processEvents)( ) 。 我們建議您清理代碼連接到[aboutToQuit()](qcoreapplication.html#aboutToQuit)信號,而不是把它在你的應用程序,`main()`功能。這是因為,在某些平臺上的QApplication.exec ( )調用可能不會返回。例如,在Windows平臺上,當用戶注銷時,系統終止進程的Qt關閉所有頂層窗口之后。因此,有_no guarantee_該應用程序將有時間退出事件循環,并執行代碼的結束`main()`功能, QApplication.exec ( )調用之后。 **See also** [quitOnLastWindowClosed](qapplication.html#quitOnLastWindowClosed-prop),[quit](qcoreapplication.html#quit)( )[exit](qcoreapplication.html#exit)( )[processEvents](qcoreapplication.html#processEvents)()和[QCoreApplication.exec](qcoreapplication.html#exec)( ) 。 ``` QWidget QApplication.focusWidget () ``` [ 返回應用程序窗口部件擁有鍵盤輸入焦點,或者0,如果在這個應用程序中沒有窗口部件具有焦點。 ](qwidget.html) [**See also**](qwidget.html) [QWidget.setFocus](qwidget.html#setFocus)( )[QWidget.hasFocus](qwidget.html#focus-prop)( )[activeWindow](qapplication.html#activeWindow)()和[focusChanged](qapplication.html#focusChanged)( ) 。 ``` QFont QApplication.font () ``` [ 返回默認應用程序字體。 ](qfont.html) [**See also**](qfont.html) [setFont](qapplication.html#setFont)( )[fontMetrics](qapplication.html#fontMetrics)()和[QWidget.font](qwidget.html#font-prop)( ) 。 ``` QFont QApplication.font (QWidget) ``` [ 這是一個重載函數。 返回的默認字體_widget_。 ](qfont.html) [**See also**](qfont.html) [fontMetrics](qapplication.html#fontMetrics)()和[QWidget.setFont](qwidget.html#font-prop)( ) 。 ``` QFont QApplication.font (str?className) ``` [ 這是一個重載函數。 返回該字體的指定部件_className_。 ](qfont.html) [**See also**](qfont.html) [setFont](qapplication.html#setFont)()和[QWidget.font](qwidget.html#font-prop)( ) 。 ``` QFontMetrics QApplication.fontMetrics () ``` [ 回報顯示應用程序的字體(屏)字體度量。 ](qfontmetrics.html) [**See also**](qfontmetrics.html) [font](qapplication.html#font)( )[setFont](qapplication.html#setFont)( )[QWidget.fontMetrics](qwidget.html#fontMetrics)()和[QPainter.fontMetrics](qpainter.html#fontMetrics)( ) 。 ``` QSize QApplication.globalStrut () ``` [](qsize.html) ``` QInputContext QApplication.inputContext (self) ``` [](qinputcontext.html) [返回](qinputcontext.html)[QInputContext](qinputcontext.html)比如所使用的應用程序。 **See also** [setInputContext](qapplication.html#setInputContext)( ) 。 ``` bool QApplication.isEffectEnabled (Qt.UIEffect) ``` 返回True如果_effect_被啟用,否則返回False 。 默認情況下, Qt會嘗試使用桌面設置。為了防止這種情況,請致電setDesktopSettingsAware (假) 。 **Note:**所有的效果都上不到16位色彩深度運行屏幕禁用。 **See also** [setEffectEnabled](qapplication.html#setEffectEnabled)()和[Qt.UIEffect](qt.html#UIEffect-enum)。 ``` bool QApplication.isLeftToRight () ``` 返回True如果應用程序的布局方向[Qt.LeftToRight](qt.html#LayoutDirection-enum)否則返回False 。 **See also** [layoutDirection](qapplication.html#layoutDirection-prop)()和[isRightToLeft](qapplication.html#isRightToLeft)( ) 。 ``` bool QApplication.isRightToLeft () ``` 返回True如果應用程序的布局方向[Qt.RightToLeft](qt.html#LayoutDirection-enum)否則返回False 。 **See also** [layoutDirection](qapplication.html#layoutDirection-prop)()和[isLeftToRight](qapplication.html#isLeftToRight)( ) 。 ``` bool QApplication.isSessionRestored (self) ``` 返回True如果該應用程序已恢復從以前的[session](index.htm)否則返回False 。 **See also** [sessionId](qapplication.html#sessionId)( )[commitData](qapplication.html#commitData)()和[saveState](qapplication.html#saveState)( ) 。 ``` Qt.LayoutDirection QApplication.keyboardInputDirection () ``` [ 返回當前的鍵盤輸入方向。 這個函數中引入了Qt 4.2中。 ``` int QApplication.keyboardInputInterval () ``` ](qt.html#LayoutDirection-enum) ``` QLocale QApplication.keyboardInputLocale () ``` [ 返回當前的鍵盤輸入法區域設置。 這個函數中引入了Qt 4.2中。 ](qlocale.html) ``` Qt.KeyboardModifiers QApplication.keyboardModifiers () ``` [](index.htm) [返回鍵盤上的組合鍵的當前狀態。目前的狀態是合同步更新事件隊列被清空,將自發地改變鍵盤狀態的事件(](index.htm)[QEvent.KeyPress](qevent.html#Type-enum)和[QEvent.KeyRelease](qevent.html#Type-enum)事件)。 應該指出,這可能無法反映所保持的輸入設備上的實際按鍵的時候調用的,而是修飾符作為最后報告在上述事件之一。如果沒有鍵被關押[Qt.NoModifier](qt.html#KeyboardModifier-enum)返回。 **See also** [mouseButtons](qapplication.html#mouseButtons)()和[queryKeyboardModifiers](qapplication.html#queryKeyboardModifiers)( ) 。 ``` Qt.LayoutDirection QApplication.layoutDirection () ``` [](qt.html#LayoutDirection-enum) ``` Qt.MouseButtons QApplication.mouseButtons () ``` [](index.htm) [返回鼠標上的按鈕的當前狀態。目前的狀態是syncronously更新事件隊列被清空,將自發地改變鼠標狀態的事件(](index.htm)[QEvent.MouseButtonPress](qevent.html#Type-enum)和[QEvent.MouseButtonRelease](qevent.html#Type-enum)事件)。 應該指出,這可能不是反映在打電話,而是在鼠標按鍵作為最后報告在上述事件之一時舉行的輸入設備上的實際按鈕。如果沒有鼠標按鈕被關押[Qt.NoButton](qt.html#MouseButton-enum)返回。 **See also** [keyboardModifiers](qapplication.html#keyboardModifiers)( ) 。 ``` bool QApplication.notify (self, QObject, QEvent) ``` 從重新實現[QCoreApplication.notify](qcoreapplication.html#notify)( ) 。 ``` QCursor QApplication.overrideCursor () ``` [ 返回當前應用程序強制光標。 此函數返回0,如果沒有應用程序的光標已經定義(即內部光標棧為空) 。 ](qcursor.html) [**See also**](qcursor.html) [setOverrideCursor](qapplication.html#setOverrideCursor)()和[restoreOverrideCursor](qapplication.html#restoreOverrideCursor)( ) 。 ``` QPalette QApplication.palette () ``` [ 返回應用程序的調色板。 ](qpalette.html) [**See also**](qpalette.html) [setPalette](qapplication.html#setPalette)()和[QWidget.palette](qwidget.html#palette-prop)( ) 。 ``` QPalette QApplication.palette (QWidget) ``` [ 這是一個重載函數。 如果_widget_通過,則返回默認調色板中的控件的類。這可能是也可能不是該應用程序的調色板。在大多數情況下,對某些類型的部件沒有特別的調色板,但一個值得注意的例外是Windows下的彈出菜單,如果用戶已經定義了一個特殊的背景顏色菜單中的顯示設置。 ](qpalette.html) [**See also**](qpalette.html) [setPalette](qapplication.html#setPalette)()和[QWidget.palette](qwidget.html#palette-prop)( ) 。 ``` QPalette QApplication.palette (str?className) ``` [ 這是一個重載函數。 返回調色板的特定部件_className_。 ](qpalette.html) [**See also**](qpalette.html) [setPalette](qapplication.html#setPalette)()和[QWidget.palette](qwidget.html#palette-prop)( ) 。 ``` Qt.KeyboardModifiers QApplication.queryKeyboardModifiers () ``` [ 查詢并返回鍵盤上的組合鍵的狀態。不像keyboardModifiers ,此方法返回在調用該方法時所保持的輸入設備上的實際按鍵。 ](index.htm) [它不依賴于已收到由該過程中,這使得它可以檢查改性劑而移動窗口,比如按鍵事件。請注意,在大多數情況下,你應該使用](index.htm)[keyboardModifiers](qapplication.html#keyboardModifiers)(),這是更快和更精確,因為它包含的改性劑的狀態,因為它們是在接收到當前處理的事件時。 此功能被引入Qt的4.8 。 **See also** [keyboardModifiers](qapplication.html#keyboardModifiers)( ) 。 ``` bool QApplication.quitOnLastWindowClosed () ``` ``` QApplication.restoreOverrideCursor () ``` 撤消上一個[setOverrideCursor](qapplication.html#setOverrideCursor)( ) 。 If [setOverrideCursor](qapplication.html#setOverrideCursor)( )被調用兩次,調用的restoreOverrideCursor ( )時將激活第一個光標集。調用此函數第二次恢復原來的小部件'游標。 **See also** [setOverrideCursor](qapplication.html#setOverrideCursor)()和[overrideCursor](qapplication.html#overrideCursor)( ) 。 ``` QApplication.saveState (self, QSessionManager?sm) ``` 這個函數處理[session management](index.htm)。它被調用時,[session manager](qsessionmanager.html)想讓應用程序保存其狀態為今后的會議。 例如,文本編輯器會創建一個臨時文件,其中包括它的編輯緩沖區,在當前編輯會話的游標等方面的位置的當前內容。 你不應該退出這個函數中的應用。相反,會話管理器可以或可以不這樣做之后,這取決于上下文。 Futhermore ,大多數會話管理器很可能會立即要求保存狀態的應用程序已經開始之后。這允許會話管理器來了解應用程序的重新啟動策略。 **Warning:**在這個函數中,沒有用戶交互是可能的,_unless_你問_manager_為明確許可。看[QSessionManager.allowsInteraction](qsessionmanager.html#allowsInteraction)()和[QSessionManager.allowsErrorInteraction](qsessionmanager.html#allowsErrorInteraction)( )了解詳情。 **See also** [isSessionRestored](qapplication.html#isSessionRestored)( )[sessionId](qapplication.html#sessionId)( )[commitData](qapplication.html#commitData)()和[Session Management](index.htm)。 ``` QString QApplication.sessionId (self) ``` 返回當前[session's](index.htm)標識符。 如果應用程序已恢復從以前的會話,這個標識符是因為它是在先前的對話一樣。會話標識符保證是唯一既為不同的應用程序和同一應用程序的不同實例。 **See also** [isSessionRestored](qapplication.html#isSessionRestored)( )[sessionKey](qapplication.html#sessionKey)( )[commitData](qapplication.html#commitData)()和[saveState](qapplication.html#saveState)( ) 。 ``` QString QApplication.sessionKey (self) ``` 返回在當前會話密鑰[session](index.htm)。 如果應用程序已恢復從以前的會話,這個鍵是一樣的,當前一交易日結束它。 隨著每次調用會話密鑰的變化[commitData](qapplication.html#commitData)()或[saveState](qapplication.html#saveState)( ) 。 **See also** [isSessionRestored](qapplication.html#isSessionRestored)( )[sessionId](qapplication.html#sessionId)( )[commitData](qapplication.html#commitData)()和[saveState](qapplication.html#saveState)( ) 。 ``` QApplication.setActiveWindow (QWidget?act) ``` 設置活動窗口到_active_小工具響應于系統事件。該功能是從特定于平臺的事件處理程序調用。 **Warning:**這個函數_not_設置鍵盤焦點到活動部件。通話[QWidget.activateWindow](qwidget.html#activateWindow)( )來代替。 它集[activeWindow](qapplication.html#activeWindow)()和[focusWidget](qapplication.html#focusWidget)( )屬性,并發送適當的[WindowActivate](qevent.html#Type-enum)/[WindowDeactivate](qevent.html#Type-enum)和[FocusIn](qevent.html#Type-enum)/[FocusOut](qevent.html#Type-enum)活動以所有適當的部件。該窗口就會處于活躍狀態涂漆(如光標在編輯行會閃爍) ,于是也有工具提示啟用。 **See also** [activeWindow](qapplication.html#activeWindow)()和[QWidget.activateWindow](qwidget.html#activateWindow)( ) 。 ``` QApplication.setAutoSipEnabled (self, bool?enabled) ``` 這種方法也是一個Qt槽與C + +的簽名`void setAutoSipEnabled(const bool)`。 ``` QApplication.setColorSpec (int) ``` 設置顏色規格為應用程序_spec_。 顏色規格控制應用程序在有限的顏色數量的顯示器上運行時,如何分配顏色,例如8位/ 256色顯示。 您之前創建的顏色規范必須設置[QApplication](qapplication.html)對象。 選項有: * [QApplication.NormalColor](qapplication.html#ColorSpec-enum). 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](qapplication.html#ColorSpec-enum). Use this option if your application needs a small number of custom colors. On X11, this option is the same as [NormalColor](qapplication.html#ColorSpec-enum). On Windows, Qt creates a Windows palette, and allocates colors to it on demand. * [QApplication.ManyColor](qapplication.html#ColorSpec-enum). 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](qapplication.html#QApplication) 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. 在Windows下,Qt創建一個Windows調色板,并配以彩色立方體填充它。 請注意,[CustomColor](qapplication.html#ColorSpec-enum)和[ManyColor](qapplication.html#ColorSpec-enum)選擇可能導致顏色映射閃爍:前臺應用程序獲取(大多數)的可用的顏色,而背景窗口會顯得那么有吸引力。 例如: ``` int main(int argc, char *argv[]) { [QApplication](qapplication.html).setColorSpec([QApplication](qapplication.html).ManyColor); [QApplication](qapplication.html) app(argc, argv); ... return app.exec(); } ``` **See also** [colorSpec](qapplication.html#colorSpec)( ) 。 ``` QApplication.setCursorFlashTime (int) ``` ``` QApplication.setDesktopSettingsAware (bool) ``` Qt的設置是否應使用系統的標準顏色,字體等,_on_。默認情況下,這是事實。 這個函數必須在創建之前調用的[QApplication](qapplication.html)對象,像這樣: ``` int main(int argc, char *argv[]) { [QApplication](qapplication.html).setDesktopSettingsAware(false); [QApplication](qapplication.html) app(argc, argv); ... return app.exec(); } ``` **See also** [desktopSettingsAware](qapplication.html#desktopSettingsAware)( ) 。 ``` QApplication.setDoubleClickInterval (int) ``` ``` QApplication.setEffectEnabled (Qt.UIEffect?effect, bool?enabled?=?True) ``` 使用戶界面效果_effect_如果_enable_為真,否則效果將不被使用。 **Note:**所有的效果都上不到16位色彩深度運行屏幕禁用。 **See also** [isEffectEnabled](qapplication.html#isEffectEnabled)( )[Qt.UIEffect](qt.html#UIEffect-enum)和[setDesktopSettingsAware](qapplication.html#setDesktopSettingsAware)( ) 。 ``` QApplication.setFont (QFont?font, str?className?=?None) ``` 更改默認應用程序字體_font_。如果_className_通過后,改變只適用于繼承類_className_(所報告的[QObject.inherits](qobject.html#inherits)())。 在應用程序啟動時,默認字體依賴于窗口系統。它可以根據這兩個窗口系統版本和語言環境而有所不同。此功能可讓您復蓋默認的字體,但壓倒一切的可能是一個壞主意,因為,例如,某些區域設置需要額外的大字體,以支持他們的特殊字符。 **Warning:**請勿在結合使用此功能[Qt Style Sheets](index.htm)。一個應用程序的字體可以使用“字體”樣式表屬性來定制。要設置粗體所有QPushButtons ,設置應用程序[styleSheet](qapplication.html#styleSheet-prop)()作為“[QPushButton](qpushbutton.html)【字體:黑體} “ **See also** [font](qapplication.html#font)( )[fontMetrics](qapplication.html#fontMetrics)()和[QWidget.setFont](qwidget.html#font-prop)( ) 。 ``` QApplication.setGlobalStrut (QSize) ``` ``` QApplication.setGraphicsSystem (QString) ``` 設置默認的圖形后端_system_,這將用于在屏幕上的小部件和QPixmaps 。可用的系統`"native"`,`"raster"`和`"opengl"`。 有幾種方法來設置圖形后端,以優先級遞減的: * the application commandline `-graphicssystem` switch * QApplication.setGraphicsSystem() * the QT_GRAPHICSSYSTEM environment variable * the Qt configure `-graphicssystem` switch 如果優先級最高的交換機設置了一個無效的名稱,該錯誤將被忽略,默認后端將被使用。 **Warning:**此功能之前,唯一有效的[QApplication](qapplication.html)構造函數被調用。 **Note:**該`"opengl"`選項當前實驗。 此功能被引入Qt的4.5 。 ``` QApplication.setInputContext (self, QInputContext) ``` 該_QInputContext_說法有它的所有權轉移給Qt的。 此函數替換了[QInputContext](qinputcontext.html)例如使用與該應用程序_inputContext_。 Qt可以給定所有權_inputContext_。 **See also** [inputContext](qapplication.html#inputContext)( ) 。 ``` QApplication.setKeyboardInputInterval (int) ``` ``` QApplication.setLayoutDirection (Qt.LayoutDirection?direction) ``` ``` QApplication.setOverrideCursor (QCursor) ``` 設置應用程序復蓋光標_cursor_。 應用程序強制光標是為了顯示該應用程序是在一個特殊的狀態,例如,可能需要一段時間的操作過程中的用戶。 這將光標直到顯示在應用程序的所有窗口部件[restoreOverrideCursor](qapplication.html#restoreOverrideCursor)()或另一個一個setOverrideCursor ()被調用。 應用程序光標被存儲在一個內部堆棧。一個setOverrideCursor ( )推光標入堆棧,并[restoreOverrideCursor](qapplication.html#restoreOverrideCursor)( )彈出活動光標堆棧。[changeOverrideCursor](qapplication.html#changeOverrideCursor)( )改變了活躍的會員...應用復蓋光標。 每一個setOverrideCursor ( )最終必須后跟一個相應的[restoreOverrideCursor](qapplication.html#restoreOverrideCursor)( ),否則棧將永遠不會被清空。 例如: ``` [QApplication](qapplication.html).setOverrideCursor([QCursor](qcursor.html)([Qt](qt.html).WaitCursor)); calculateHugeMandelbrot(); // lunch time... [QApplication](qapplication.html).restoreOverrideCursor(); ``` **See also** [overrideCursor](qapplication.html#overrideCursor)( )[restoreOverrideCursor](qapplication.html#restoreOverrideCursor)( )[changeOverrideCursor](qapplication.html#changeOverrideCursor)()和[QWidget.setCursor](qwidget.html#cursor-prop)( ) 。 ``` QApplication.setPalette (QPalette?palette, str?className?=?None) ``` 更改默認的應用程序調色板_palette_。 If _className_通過后,改變只適用于繼承部件_className_(所報告的[QObject.inherits](qobject.html#inherits)())。如果_className_剩下0 ,則更改會影響所有部件,從而復蓋任何先前設置的類特定的調色板。 調色板可以根據當前的GUI樣式中被改變[QStyle.polish](qstyle.html#polish)( ) 。 **Warning:**請勿在結合使用此功能[Qt Style Sheets](index.htm)。當使用樣式表,一個小部件的調色板可以使用“顏色” , “背景色” , “選擇顏色” , “選擇 - 背景色”和“復用背景色”進行自定義。 **Note:**有些樣式不使用調色板的所有圖紙,舉例來說,如果他們利用原生主題引擎。這是Windows XP , Windows Vista和Mac OS X的風格的情況下。 **See also** [QWidget.setPalette](qwidget.html#palette-prop)( )[palette](qapplication.html#palette)()和[QStyle.polish](qstyle.html#polish)( ) 。 ``` QApplication.setQuitOnLastWindowClosed (bool?quit) ``` ``` QApplication.setStartDragDistance (int?l) ``` ``` QApplication.setStartDragTime (int?ms) ``` ``` QApplication.setStyle (QStyle) ``` 該_QStyle_說法有它的所有權轉移給Qt的。 設置應用程序的圖形用戶界面風格_style_。樣式對象的所有權被轉移到[QApplication](qapplication.html),所以[QApplication](qapplication.html)將刪除應用程序退出或者當一個新樣式設置和舊風格仍然是應用程序對象的父項的樣式對象。 用法示例: ``` [QApplication](qapplication.html).setStyle(new [QWindowsStyle](index.htm)); ``` 當切換應用的樣式,顏色調色板設置恢復到初始的顏色或系統默認值。這是必要的,因為某些樣式必須適應調色板是完全風格指南標準。 調色板之前,設置樣式已定,即之前創建[QApplication](qapplication.html),會導致應用程序使用[QStyle.standardPalette](qstyle.html#standardPalette)( )的調色板。 **Warning:**目前不支持Qt的樣式表定制[QStyle](qstyle.html)子類。我們計劃在未來的版本解決這個問題。 **See also** [style](qapplication.html#style)( )[QStyle](qstyle.html),[setPalette](qapplication.html#setPalette)()和[desktopSettingsAware](qapplication.html#desktopSettingsAware)( ) 。 ``` QStyle QApplication.setStyle (QString) ``` [ 這是一個重載函數。 ](qstyle.html) [請求](qstyle.html)[QStyle](qstyle.html)對于對象_style_從[QStyleFactory](qstylefactory.html)。 該字符串必須是一個[QStyleFactory.keys](qstylefactory.html#keys)() ,典型的“窗口”, 1 , “基序”,“ CDE ”,“ PLASTIQUE ”,“ WindowsXP的”或“蘋果” 。樣式名不區分大小寫。 返回0,如果一個未知_style_通過,否則[QStyle](qstyle.html)返回的對象被設置為應用程序的圖形用戶界面風格。 **Warning:**為了確保應用程序的風格設置是否正確,最好是前調用這個函數[QApplication](qapplication.html)構造函數,如果可能的話。 ``` QApplication.setStyleSheet (self, QString?sheet) ``` 這種方法也是一個Qt槽與C + +的簽名`void setStyleSheet(const QString&)`。 ``` QApplication.setWheelScrollLines (int) ``` ``` QApplication.setWindowIcon (QIcon?icon) ``` ``` int QApplication.startDragDistance () ``` ``` int QApplication.startDragTime () ``` ``` QStyle QApplication.style () ``` [ 返回應用程序的樣式對象。 ](qstyle.html) [**See also**](qstyle.html) [setStyle](qapplication.html#setStyle)() and [QStyle](qstyle.html). ``` QString QApplication.styleSheet (self) ``` ``` QApplication.syncX () ``` 與同步在X11實現X服務器。這通常需要一些時間。什么都不做在其他平臺上。 ``` QWidget QApplication.topLevelAt (QPoint?p) ``` [ 返回頂層窗口部件在給定的_point_;返回0,如果沒有這樣的小部件。 ](qwidget.html) ``` QWidget QApplication.topLevelAt (int?x, int?y) ``` [ 這是一個重載函數。 返回頂層窗口部件在點(_x_,_y_) ;返回0 ,如果不存在這樣的窗口小部件。 ``` list-of-QWidget QApplication.topLevelWidgets () ``` 返回頂層窗口小部件(窗口)中的應用程序的列表。 **Note:**一些頂級小部件可能會被隱藏,例如工具提示,如果沒有提示當前顯示。 例如: ](qwidget.html) ``` void showAllHiddenTopLevelWidgets() { foreach (QWidget *widget, [QApplication](qapplication.html).topLevelWidgets()) { if (widget->isHidden()) widget->show(); } } ``` **See also** [allWidgets](qapplication.html#allWidgets)( )[QWidget.isWindow](qwidget.html#isWindow)()和[QWidget.isHidden](qwidget.html#isHidden)( ) 。 ``` Type QApplication.type () ``` [](qapplication.html#Type-enum) [返回應用程序的類型(](qapplication.html#Type-enum)[Tty](qapplication.html#Type-enum),[GuiClient](qapplication.html#Type-enum)或[GuiServer](qapplication.html#Type-enum)) 。該類型是施工時設置[QApplication](qapplication.html)對象。 ``` int QApplication.wheelScrollLines () ``` ``` QWidget QApplication.widgetAt (QPoint?p) ``` [ 返回小部件在全局屏幕位置_point_或0,如果沒有Qt插件那里。 此功能可能會很慢。 ](qwidget.html) [**See also**](qwidget.html) [QCursor.pos](qcursor.html#pos)( )[QWidget.grabMouse](qwidget.html#grabMouse)()和[QWidget.grabKeyboard](qwidget.html#grabKeyboard)( ) 。 ``` QWidget QApplication.widgetAt (int?x, int?y) ``` [](qwidget.html) ``` QIcon QApplication.windowIcon () ``` [ ``` bool QApplication.x11EventFilter (self, sip.voidptr) ``` **Warning:**這個虛函數僅X11下實現的。 ](qicon.html) [如果你創建一個繼承的應用程序](qicon.html)[QApplication](qapplication.html)并且重新實現這個功能,你可以直接訪問該從X服務器接收到的所有X事件。該事件傳遞的_event_參數。 如果你想從被處理停止事件,則返回True 。返回False對于普通事件分派。默認實現返回False 。 這是唯一的解決直接被過濾的郵件。您必須直接在事件調度程序,這是由返回安裝一個事件過濾器[QAbstractEventDispatcher.instance](qabstracteventdispatcher.html#instance)( ) ,以處理全系統的消息。 **See also** [x11ProcessEvent](qapplication.html#x11ProcessEvent)( ) 。 ``` int QApplication.x11ProcessEvent (self, sip.voidptr) ``` 這個函數做個體X的核心處理_event_秒,通常由調度Qt的事件到正確的目的地。 它返回1,如果該事件被消耗了特殊處理, 0如果_event_由正常的處理消耗, -1,如果_event_是一個無法識別的部件。 **See also** [x11EventFilter](qapplication.html#x11EventFilter)( ) 。 * * * ## Qt Signal Documentation ``` void commitDataRequest (QSessionManager&) ``` 這是該信號的默認超載。 該信號處理[session management](index.htm)。它被發射時的[QSessionManager](qsessionmanager.html)想讓應用程序提交的所有數據。 通常,這意味著保存所有打開的文件,從用戶得到允許后。此外,您可能需要提供由用戶可以取消關機的手段。 你不應該離開這個信號中的應用。相反,會話管理器可以或可以不這樣做之后,這取決于上下文。 **Warning:**在這個信號,無用戶交互是可能的,_unless_你問_manager_為明確許可。看[QSessionManager.allowsInteraction](qsessionmanager.html#allowsInteraction)()和[QSessionManager.allowsErrorInteraction](qsessionmanager.html#allowsErrorInteraction)( )了解詳情和用法示例。 **Note:**您應該使用[Qt.DirectConnection](qt.html#ConnectionType-enum)連接到這個信號時。 這個函數中引入了Qt 4.2中。 **See also** [isSessionRestored](qapplication.html#isSessionRestored)( )[sessionId](qapplication.html#sessionId)( )[saveState](qapplication.html#saveState)()和[Session Management](index.htm)。 ``` void focusChanged (QWidget *,QWidget *) ``` 這是該信號的默認超載。 這個信號被發射時具有鍵盤焦點的窗口小部件的改變_old_至_now_,即,因為用戶按下Tab鍵,點擊進入小部件或改變活動窗口。兩_old_和_now_可以是空指針。 該信號發出后兩個部件都經過已經被告知了變化[QFocusEvent](qfocusevent.html)。 這個函數是Qt 4.1中引入。 **See also** [QWidget.setFocus](qwidget.html#setFocus)( )[QWidget.clearFocus](qwidget.html#clearFocus)()和[Qt.FocusReason](qt.html#FocusReason-enum)。 ``` void fontDatabaseChanged () ``` 這是該信號的默認超載。 這個信號時應用的字體被加載或移除射出。 此功能被引入Qt的4.5 。 **See also** [QFontDatabase.addApplicationFont](qfontdatabase.html#addApplicationFont)( )[QFontDatabase.addApplicationFontFromData](qfontdatabase.html#addApplicationFontFromData)( )[QFontDatabase.removeAllApplicationFonts](qfontdatabase.html#removeAllApplicationFonts)()和[QFontDatabase.removeApplicationFont](qfontdatabase.html#removeApplicationFont)( ) 。 ``` void lastWindowClosed () ``` 這是該信號的默認超載。 這個信號從發射[QApplication.exec](qapplication.html#exec)( )當最后一個可見的主窗口(即窗口沒有父)與[Qt.WA_QuitOnClose](qt.html#WidgetAttribute-enum)屬性設置是關閉的。 默認情況下, * this attribute is set for all widgets except transient windows such as splash screens, tool windows, and popup menus * [QApplication](qapplication.html) implicitly quits when this signal is emitted. 此功能可以通過設置關閉[quitOnLastWindowClosed](qapplication.html#quitOnLastWindowClosed-prop)為False。 **See also** [QWidget.close](qwidget.html#close)( ) 。 ``` void saveStateRequest (QSessionManager&) ``` 這是該信號的默認超載。 該信號處理[session management](index.htm)。它被調用時,[session manager](qsessionmanager.html)想讓應用程序保存其狀態為今后的會議。 例如,文本編輯器會創建一個臨時文件,其中包括它的編輯緩沖區,在當前編輯會話的游標等方面的位置的當前內容。 你不應該離開這個信號中的應用。相反,會話管理器可以或可以不這樣做之后,這取決于上下文。 Futhermore ,大多數會話管理器很可能會立即要求保存狀態的應用程序已經開始之后。這允許會話管理器來了解應用程序的重新啟動策略。 **Warning:**在這個函數中,沒有用戶交互是可能的,_unless_你問_manager_為明確許可。看[QSessionManager.allowsInteraction](qsessionmanager.html#allowsInteraction)()和[QSessionManager.allowsErrorInteraction](qsessionmanager.html#allowsErrorInteraction)( )了解詳情。 **Note:**您應該使用[Qt.DirectConnection](qt.html#ConnectionType-enum)連接到這個信號時。 這個函數中引入了Qt 4.2中。 **See also** [isSessionRestored](qapplication.html#isSessionRestored)( )[sessionId](qapplication.html#sessionId)( )[commitData](qapplication.html#commitData)()和[Session Management](index.htm)。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看