<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智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # QMessageBox Class Reference ## [[QtGui](index.htm) module] 該QMessageBox提示類提供通知用戶或詢問用戶問題,并接收應答模式對話框。[More...](#details) 繼承[QDialog](qdialog.html)。 ### Types * `enum ButtonRole { InvalidRole, AcceptRole, RejectRole, DestructiveRole, ..., ApplyRole }` * `enum Icon { NoIcon, Information, Warning, Critical, Question }` * `enum StandardButton { NoButton, Ok, Save, SaveAll, ..., ButtonMask }` * `class **[StandardButtons](index.htm)**` ### Methods * `__init__ (self, QWidget?parent?=?None)` * `__init__ (self, Icon?icon, QString?title, QString?text, StandardButtons?buttons?=?QMessageBox.NoButton, QWidget?parent?=?None, Qt.WindowFlags?flags?=?Qt.Dialog|Qt.MSWindowsFixedSizeDialogHint)` * `__init__ (self, QString?title, QString?text, Icon?icon, int?button0, int?button1, int?button2, QWidget?parent?=?None, Qt.WindowFlags?flags?=?Qt.Dialog|Qt.MSWindowsFixedSizeDialogHint)` * `addButton (self, QAbstractButton?button, ButtonRole?role)` * `QPushButton addButton (self, QString?text, ButtonRole?role)` * `QPushButton addButton (self, StandardButton?button)` * `QAbstractButton button (self, StandardButton?which)` * `ButtonRole buttonRole (self, QAbstractButton?button)` * `list-of-QAbstractButton buttons (self)` * `QString buttonText (self, int?button)` * `changeEvent (self, QEvent)` * `QAbstractButton clickedButton (self)` * `closeEvent (self, QCloseEvent)` * `QPushButton defaultButton (self)` * `QString detailedText (self)` * `QAbstractButton escapeButton (self)` * `bool event (self, QEvent?e)` * `Icon icon (self)` * `QPixmap iconPixmap (self)` * `QString informativeText (self)` * `keyPressEvent (self, QKeyEvent)` * `open (self)` * `open (self, QObject?receiver, SLOT()SLOT()?member)` * `open (self, callable?receiver)` * `removeButton (self, QAbstractButton?button)` * `resizeEvent (self, QResizeEvent)` * `setButtonText (self, int?button, QString)` * `setDefaultButton (self, QPushButton?button)` * `setDefaultButton (self, StandardButton?button)` * `setDetailedText (self, QString?text)` * `setEscapeButton (self, QAbstractButton?button)` * `setEscapeButton (self, StandardButton?button)` * `setIcon (self, Icon)` * `setIconPixmap (self, QPixmap)` * `setInformativeText (self, QString?text)` * `setStandardButtons (self, StandardButtons?buttons)` * `setText (self, QString)` * `setTextFormat (self, Qt.TextFormat)` * `setWindowModality (self, Qt.WindowModality?windowModality)` * `setWindowTitle (self, QString?title)` * `showEvent (self, QShowEvent)` * `QSize sizeHint (self)` * `StandardButton standardButton (self, QAbstractButton?button)` * `StandardButtons standardButtons (self)` * `QString text (self)` * `Qt.TextFormat textFormat (self)` ### Static Methods * `about (QWidget?parent, QString?caption, QString?text)` * `aboutQt (QWidget?parent, QString?title?=?QString())` * `StandardButton critical (QWidget?parent, QString?title, QString?text, StandardButtons?buttons?=?QMessageBox.Ok, StandardButton?defaultButton?=?QMessageBox.NoButton)` * `int critical (QWidget?parent, QString?title, QString?text, int?button0, int?button1, int?button2?=?0)` * `int critical (QWidget?parent, QString?title, QString?text, QString?button0Text, QString?button1Text?=?QString(), QString?button2Text?=?QString(), int?defaultButtonNumber?=?0, int?escapeButtonNumber?=?-1)` * `StandardButton information (QWidget?parent, QString?title, QString?text, StandardButtons?buttons?=?QMessageBox.Ok, StandardButton?defaultButton?=?QMessageBox.NoButton)` * `int information (QWidget?parent, QString?title, QString?text, int?button0, int?button1?=?0, int?button2?=?0)` * `int information (QWidget?parent, QString?title, QString?text, QString?button0Text, QString?button1Text?=?QString(), QString?button2Text?=?QString(), int?defaultButtonNumber?=?0, int?escapeButtonNumber?=?-1)` * `StandardButton question (QWidget?parent, QString?title, QString?text, StandardButtons?buttons?=?QMessageBox.Ok, StandardButton?defaultButton?=?QMessageBox.NoButton)` * `int question (QWidget?parent, QString?title, QString?text, int?button0, int?button1?=?0, int?button2?=?0)` * `int question (QWidget?parent, QString?title, QString?text, QString?button0Text, QString?button1Text?=?QString(), QString?button2Text?=?QString(), int?defaultButtonNumber?=?0, int?escapeButtonNumber?=?-1)` * `QPixmap standardIcon (Icon?icon)` * `StandardButton warning (QWidget?parent, QString?title, QString?text, StandardButtons?buttons?=?QMessageBox.Ok, StandardButton?defaultButton?=?QMessageBox.NoButton)` * `int warning (QWidget?parent, QString?title, QString?text, int?button0, int?button1, int?button2?=?0)` * `int warning (QWidget?parent, QString?title, QString?text, QString?button0Text, QString?button1Text?=?QString(), QString?button2Text?=?QString(), int?defaultButtonNumber?=?0, int?escapeButtonNumber?=?-1)` ### Qt Signals * `void buttonClicked (QAbstractButton *)` * * * ## Detailed Description 該QMessageBox提示類提供通知用戶或詢問用戶問題,并接收應答模式對話框。 一個消息框顯示一個主[text](qmessagebox.html#text-prop)要提醒用戶的情況下,一[informative text](qmessagebox.html#informativeText-prop)進一步解釋警報或詢問用戶問題,以及一個可選的[detailed text](qmessagebox.html#detailedText-prop)到如果用戶請求它提供甚至更多的數據。一個消息框還可以顯示[icon](qmessagebox.html#icon-prop)和[standard buttons](qmessagebox.html#standardButtons-prop)用于接受用戶的響應。 提供兩個API使用QMessageBox提示,該物業為基礎的API ,和靜態函數。調用的靜態功能之一是簡單的方法,但它比使用基于屬性的API,彈性較差,其結果是不夠豐富。使用基于屬性的API被推薦。 ### The Property-based API 使用該物業的API ,構建QMessageBox提示的實例,設置所需的屬性和調用[exec_](qmessagebox.html#exec)( )來顯示訊息。最簡單的配置是僅設置[message text](qmessagebox.html#text-prop)屬性。 ``` QMessageBox msgBox; msgBox.setText("The document has been modified."); msgBox.exec_(); ``` 用戶必須點擊**OK**按鈕來關閉消息框。 GUI的其馀部分被阻塞,直到消息框被駁回。 ![](https://img.kancloud.cn/ff/da/ffda0a92ab81fe47d29fc7254f5a77a4_301x124.png) 比只是提醒用戶事件更好的辦法是還詢問用戶該怎么辦才好。存儲在這個問題[informative text](qmessagebox.html#informativeText-prop)屬性,并設置[standard buttons](qmessagebox.html#standardButtons-prop)屬性設置為你想要的設置的用戶響應的組按鈕。這些按鈕由合并指定的值[StandardButtons](qmessagebox.html#StandardButton-enum)使用按位OR運算符。對于按鈕的顯示順序是依賴于平臺的。例如,在Windows上,**Save**被顯示到左側**Cancel**,而在Mac OS上,順序是相反的。 紀念你的標準按鈕之一,是你的[default button](qmessagebox.html#defaultButton)。 ``` QMessageBox msgBox; msgBox.setText("The document has been modified."); msgBox.setInformativeText("Do you want to save your changes?"); msgBox.setStandardButtons(QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel); msgBox.setDefaultButton(QMessageBox.Save); int ret = msgBox.exec_(); ``` 這是推薦的做法 [Mac OS X Guidelines](http://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AppleHIGuidelines/Windows/Windows.html#//apple_ref/doc/uid/20000961-BABCAJID)。類似的準則適用于其他平臺,但要注意方式的不同[informative text](qmessagebox.html#informativeText-prop)針對不同的平臺進行處理。 ![](https://img.kancloud.cn/15/8a/158a51ede8abc99ac8bea7bac293e244_314x135.png) 該[exec_](qmessagebox.html#exec)()槽返回[StandardButtons](qmessagebox.html#StandardButton-enum)單擊的按鈕的值。 ``` switch (ret) { case QMessageBox.Save: // Save was clicked break; case QMessageBox.Discard: // Don't Save was clicked break; case QMessageBox.Cancel: // Cancel was clicked break; default: // should never be reached break; } ``` 為了給用戶更多的信息,以幫助他回答這個問題,設置[detailed text](qmessagebox.html#detailedText-prop)屬性。如果[detailed text](qmessagebox.html#detailedText-prop)屬性設置,**Show Details...**將顯示按鈕。 ![](https://img.kancloud.cn/19/70/1970bbfab9356a81a780949017bad2ad_467x128.png) 點擊**Show Details...**按鈕將顯示詳細的文字。 ![](https://img.kancloud.cn/4b/d4/4bd49f73ca9e0b58c9a5fd4c7cefeaa5_466x245.png) #### Rich Text and the Text Format Property 該[detailed text](qmessagebox.html#detailedText-prop)屬性總是被解釋為純文本。該[main text](qmessagebox.html#text-prop)和[informative text](qmessagebox.html#informativeText-prop)性能可以是純文本或富文本。這些字符串是根據所設定的解釋[text format](qmessagebox.html#textFormat-prop)屬性。默認設置為[auto-text](qt.html#TextFormat-enum)。 請注意,對于包含XML的元字符的一些純文本字符串,自動文本[rich text detection test](qt.html#mightBeRichText)可能會失敗,從而導致你的純文本字符串被錯誤地解釋為富文本。在這些罕見的情況下,使用[Qt.convertFromPlainText](qt.html#convertFromPlainText)( )到您的純文本字符串轉換為等效的視覺豐富的文本字符串,或將[text format](qmessagebox.html#textFormat-prop)屬性明確與[setTextFormat](qmessagebox.html#textFormat-prop)( ) 。 #### Severity Levels and the Icon and Pixmap Properties QMessageBox提示支持四種預定義的消息嚴重級別,或消息類型,這真的只是不同的預定義的圖標,他們每場演出。通過設置指定四個預定義的消息類型之一的[icon](qmessagebox.html#icon-prop)屬性的一個[predefined icons](qmessagebox.html#Icon-enum)。以下規則的指導方針: | ![](https://img.kancloud.cn/2b/9d/2b9d222b82c662fb58a70d4a58ed200c_39x38.png) | [Question](qmessagebox.html#Icon-enum) | For asking a question during normal operations. | | ![](https://img.kancloud.cn/63/72/63726eaa7b48d826a8426cdf14c06407_37x36.png) | [Information](qmessagebox.html#Icon-enum) | For reporting information about normal operations. | | ![](https://img.kancloud.cn/c0/6c/c06c29f61b1dfc6e77af771a890becd6_40x39.png) | [Warning](qmessagebox.html#Icon-enum) | For reporting non-critical errors. | | ![](https://img.kancloud.cn/54/62/54629565b203a26603fb2b76a5abfaf0_37x36.png) | [Critical](qmessagebox.html#Icon-enum) | For reporting critical errors. | [Predefined icons](qmessagebox.html#Icon-enum)不受QMessageBox提示定義的,而是由式提供。缺省值是[No Icon](qmessagebox.html#Icon-enum)。該消息框,否則相同的所有案件。當使用一個標準的圖標,推薦使用表中的一個,或者使用建議您使用平臺的風格準則之一。如果沒有一個標準的圖標是適合你的消息框,你可以通過設置使用自定義圖標[icon pixmap](qmessagebox.html#iconPixmap-prop)財產,而不是設置[icon](qmessagebox.html#icon-prop)屬性。 總之,要設置一個圖標,用_either_ [setIcon](qmessagebox.html#icon-prop)( )為標準圖標之一,_or_ [setIconPixmap](qmessagebox.html#iconPixmap-prop)()為一個自定義圖標。 ### The Static Functions API 建立消息框與靜態函數的API,雖然方便,比使用基于屬性的API,彈性較差,因為靜態函數簽名缺少用于設置參數[informative text](qmessagebox.html#informativeText-prop)和[detailed text](qmessagebox.html#detailedText-prop)屬性。一個工作圍繞這一直使用`title`參數為消息框正文及`text`參數為消息框翔實的文字。因為這具有使一個不太可讀的消息框的明顯缺點,平臺指引不建議這樣做。該_Microsoft Windows User Interface Guidelines_建議使用[application name](qcoreapplication.html#applicationName-prop)作為[window's title](qmessagebox.html#setWindowTitle),這意味著,如果你有除了你的主文本的信息文本,你必須將它連接到`text`參數。 注意,靜態函數簽名,相對于它們的鍵參數,而現在用于設置改變[standard buttons](qmessagebox.html#standardButtons-prop)和[default button](qmessagebox.html#defaultButton)。 靜態函數可用于創建[information](qmessagebox.html#information)( )[question](qmessagebox.html#question)( )[warning](qmessagebox.html#warning)()和[critical](qmessagebox.html#critical)( )消息框。 ``` int ret = QMessageBox.warning(this, tr("My Application"), tr("The document has been modified.\n" "Do you want to save your changes?"), QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel, QMessageBox.Save); ``` 該[Standard Dialogs](index.htm)示例顯示了如何使用QMessageBox提示和其他內置Qt對話框。 ### Advanced Usage 如果[standard buttons](qmessagebox.html#StandardButton-enum)不夠靈活,你的消息框,您可以使用[addButton](qmessagebox.html#addButton)( )過載,需要一個文本和一個ButtonRoleto添加自定義按鈕。該[ButtonRole](qmessagebox.html#ButtonRole-enum)所使用QMessageBox提示來確定屏幕上的按鈕的順序(它根據平臺而異)。您可以測試的價值[clickedButton](qmessagebox.html#clickedButton)( )調用后[exec_](qmessagebox.html#exec)( ) 。例如, ``` QMessageBox msgBox; [QPushButton](qpushbutton.html) *connectButton = msgBox.addButton(tr("Connect"), QMessageBox.ActionRole); [QPushButton](qpushbutton.html) *abortButton = msgBox.addButton(QMessageBox.Abort); msgBox.exec_(); if (msgBox.clickedButton() == connectButton) { // connect } else if (msgBox.clickedButton() == abortButton) { // abort } ``` ### Default and Escape Keys 默認按鈕(即按鈕激活時,**Enter**被按下)可以使用被指定[setDefaultButton](qmessagebox.html#setDefaultButton)( ) 。如果沒有指定一個缺省按鈕, QMessageBox提示試圖找到一個基于所述[button roles](qmessagebox.html#ButtonRole-enum)在消息框中使用的按鈕。 逃生按鈕(按鈕激活時,**Esc**被按下)可以使用被指定[setEscapeButton](qmessagebox.html#setEscapeButton)( ) 。如果未指定逃跑按鈕, QMessageBox提示嘗試使用這些規則,以找到一個: 1. 如果只有一個按鈕,它是激活的按鈕時**Esc**被按下。 2. 如果有一個[Cancel](qmessagebox.html#StandardButton-enum)按鈕,它是激活按鈕時**Esc**被按下。 3. 如果恰好有一個按鈕有兩種[the Reject role](qmessagebox.html#ButtonRole-enum)或[the No role](qmessagebox.html#ButtonRole-enum),它是在按鈕被激活時**Esc**被按下。 當不能使用這些規則,按確定的逃生按鈕**Esc**沒有任何影響。 * * * ## Type Documentation ``` QMessageBox.ButtonRole ``` 該枚舉描述了可用于描述按鍵在按鈕框的作用。這些角色的組合作為標志用來形容他們的行為的不同方面。 | Constant | Value | Description | | --- | --- | --- | | `QMessageBox.InvalidRole` | `-1` | 該按鈕是無效的。 | | `QMessageBox.AcceptRole` | `0` | 單擊該按鈕被接受的對話框(如確定)。 | | `QMessageBox.RejectRole` | `1` | 單擊該按鈕會導致被拒絕的對話框(例如取消) 。 | | `QMessageBox.DestructiveRole` | `2` | 單擊該按鈕會導致破壞性的變化(例如,用于舍棄變更) ,然后關閉對話框。 | | `QMessageBox.ActionRole` | `3` | 單擊該按鈕使更改對話框中的元素。 | | `QMessageBox.HelpRole` | `4` | 該按鈕可點擊,請求幫助。 | | `QMessageBox.YesRole` | `5` | 該按鈕是一個“是”形按鈕。 | | `QMessageBox.NoRole` | `6` | 該按鈕是一個“無”形按鈕。 | | `QMessageBox.ApplyRole` | `8` | 按鈕適用電流的變化。 | | `QMessageBox.ResetRole` | `7` | 按鈕重置對話框的字段默認值。 | **See also** [StandardButton](qmessagebox.html#StandardButton-enum)。 ``` QMessageBox.Icon ``` 該枚舉具有下列值: | Constant | Value | Description | | --- | --- | --- | | `QMessageBox.NoIcon` | `0` | 消息框沒有任何圖標。 | | `QMessageBox.Question` | `4` | 一個圖標表明該消息是問一個問題。 | | `QMessageBox.Information` | `1` | 一個圖標,表示該消息是沒有什么兩樣的。 | | `QMessageBox.Warning` | `2` | 一個圖標指示該消息是一個警告,但也可以處理。 | | `QMessageBox.Critical` | `3` | 一個圖標指示該消息表示一個嚴重的問題。 | ``` QMessageBox.StandardButton ``` 這些枚舉描述了標準按鈕標志。每個按鈕都有一個定義[ButtonRole](qmessagebox.html#ButtonRole-enum)。 | Constant | Value | Description | | --- | --- | --- | | `QMessageBox.Ok` | `0x00000400` | 與定義的一個“OK”按鈕[AcceptRole](qmessagebox.html#ButtonRole-enum)。 | | `QMessageBox.Open` | `0x00002000` | 與定義的“打開”按鈕[AcceptRole](qmessagebox.html#ButtonRole-enum)。 | | `QMessageBox.Save` | `0x00000800` | 與定義的“保存”按鈕[AcceptRole](qmessagebox.html#ButtonRole-enum)。 | | `QMessageBox.Cancel` | `0x00400000` | “取消”的按鈕定義[RejectRole](qmessagebox.html#ButtonRole-enum)。 | | `QMessageBox.Close` | `0x00200000` | 與定義的“關閉”按鈕[RejectRole](qmessagebox.html#ButtonRole-enum)。 | | `QMessageBox.Discard` | `0x00800000` | A“放棄”或“不保存”按鈕,根據不同的平臺上,與定義[DestructiveRole](qmessagebox.html#ButtonRole-enum)。 | | `QMessageBox.Apply` | `0x02000000` | 一個“應用”的定義的按鈕[ApplyRole](qmessagebox.html#ButtonRole-enum)。 | | `QMessageBox.Reset` | `0x04000000` | “復位”的定義的按鈕[ResetRole](qmessagebox.html#ButtonRole-enum)。 | | `QMessageBox.RestoreDefaults` | `0x08000000` | A“還原為默認值”的定義的按鈕[ResetRole](qmessagebox.html#ButtonRole-enum)。 | | `QMessageBox.Help` | `0x01000000` | 與定義的“幫助”按鈕[HelpRole](qmessagebox.html#ButtonRole-enum)。 | | `QMessageBox.SaveAll` | `0x00001000` | 與定義的“全部保存”按鈕[AcceptRole](qmessagebox.html#ButtonRole-enum)。 | | `QMessageBox.Yes` | `0x00004000` | 與定義的“Yes”按鈕[YesRole](qmessagebox.html#ButtonRole-enum)。 | | `QMessageBox.YesToAll` | `0x00008000` | 與定義的“全是”按鈕[YesRole](qmessagebox.html#ButtonRole-enum)。 | | `QMessageBox.No` | `0x00010000` | 與定義的“否”按鈕[NoRole](qmessagebox.html#ButtonRole-enum)。 | | `QMessageBox.NoToAll` | `0x00020000` | 與定義的“全否”按鈕[NoRole](qmessagebox.html#ButtonRole-enum)。 | | `QMessageBox.Abort` | `0x00040000` | 與定義的“中止”按鈕[RejectRole](qmessagebox.html#ButtonRole-enum)。 | | `QMessageBox.Retry` | `0x00080000` | 與定義的“重試”按鈕[AcceptRole](qmessagebox.html#ButtonRole-enum)。 | | `QMessageBox.Ignore` | `0x00100000` | 一個“忽略”的定義的按鈕[AcceptRole](qmessagebox.html#ButtonRole-enum)。 | | `QMessageBox.NoButton` | `0x00000000` | 無效的按鈕。 | 下面的值已過時: | Constant | Value | Description | | --- | --- | --- | | `QMessageBox.YesAll` | `YesToAll` | 使用YesToAll代替。 | | `QMessageBox.NoAll` | `NoToAll` | 改用NoToAll 。 | | `QMessageBox.Default` | `0x00000100` | 使用`defaultButton`的說法[information](qmessagebox.html#information)( )[warning](qmessagebox.html#warning)( )等來代替,或致電[setDefaultButton](qmessagebox.html#setDefaultButton)( ) 。 | | `QMessageBox.Escape` | `0x00000200` | Call [setEscapeButton](qmessagebox.html#setEscapeButton)( )來代替。 | | `QMessageBox.FlagMask` | `0x00000300` | ? | | `QMessageBox.ButtonMask` | `~FlagMask` | ? | 這個枚舉被引入或修改的Qt 4.2 。 該StandardButtons類型是一個typedef為[QFlags](index.htm)\u003cStandardButton\u003e 。它存儲StandardButton值的或組合。 **See also** [ButtonRole](qmessagebox.html#ButtonRole-enum)和[standardButtons](qmessagebox.html#standardButtons-prop)。 * * * ## Method Documentation ``` QMessageBox.__init__ (self, QWidget?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個消息框,沒有文字,沒有任何按鍵。_parent_被傳遞到[QDialog](qdialog.html)構造函數。 在Mac OS X ,如果你希望你的消息框顯示為[Qt.Sheet](qt.html#WindowType-enum)其_parent_,設置消息框的[window modality](qmessagebox.html#setWindowModality)至[Qt.WindowModal](qt.html#WindowModality-enum)或者使用[open](qmessagebox.html#open)( ) 。否則,消息框將是一個標準的對話框。 ``` QMessageBox.__init__ (self, Icon?icon, QString?title, QString?text, StandardButtons?buttons?=?QMessageBox.NoButton, QWidget?parent?=?None, Qt.WindowFlags?flags?=?Qt.Dialog|Qt.MSWindowsFixedSizeDialogHint) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個消息框,用給定的_icon_,_title_,_text_和標準_buttons_。標準或自定義按鈕可以在任何時候使用加[addButton](qmessagebox.html#addButton)( ) 。該_parent_和_f_參數被傳遞到[QDialog](qdialog.html)構造函數。 該消息框是一個[application modal](qt.html#WindowModality-enum)對話框。 在Mac OS X中,如果_parent_不為0 ,你希望你的消息框顯示為[Qt.Sheet](qt.html#WindowType-enum)該父,設置消息框的[window modality](qmessagebox.html#setWindowModality)至[Qt.WindowModal](qt.html#WindowModality-enum)(默認值) 。否則,消息框將是一個標準的對話框。 **See also** [setWindowTitle](qmessagebox.html#setWindowTitle)( )[setText](qmessagebox.html#text-prop)( )[setIcon](qmessagebox.html#icon-prop)()和[setStandardButtons](qmessagebox.html#standardButtons-prop)( ) 。 ``` QMessageBox.__init__ (self, QString?title, QString?text, Icon?icon, int?button0, int?button1, int?button2, QWidget?parent?=?None, Qt.WindowFlags?flags?=?Qt.Dialog|Qt.MSWindowsFixedSizeDialogHint) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 ``` QMessageBox.about (QWidget?parent, QString?caption, QString?text) ``` 顯示一個簡單的關于與標題框_title_和文本_text_。關于對話框的父_parent_。 關于( )會在四個地點合適的圖標: 1. 它喜歡[parent-&gt;icon()](qwidget.html#windowIcon-prop)如果存在。 2. 如果不是,它會嘗試包含頂級窗口部件_parent_。 3. 如果失敗,它會嘗試[active window.](qapplication.html#activeWindow) 4. 作為最后的手段,它使用的信息圖標。 關于對話框上有標注為“確定”的單一按鈕。在Mac OS X中,關于對話框彈出時為無模式窗口,在其他平臺上,它是目前應用程序模式。 **See also** [QWidget.windowIcon](qwidget.html#windowIcon-prop)()和[QApplication.activeWindow](qapplication.html#activeWindow)( ) 。 ``` QMessageBox.aboutQt (QWidget?parent, QString?title?=?QString()) ``` 顯示關于Qt的一個簡單的消息框,用給定的_title_并集中在_parent_(如果_parent_不為0 ) 。該消息包括對Qt的正在使用的應用程序的版本號。 這是納入有用**Help**一個應用程序的菜單,如圖中[Menus](index.htm)例子。 [QApplication](qapplication.html)提供此功能的插槽。 在Mac OS X中,關于對話框彈出時為無模式窗口,在其他平臺上,它是目前應用程序模式。 **See also** [QApplication.aboutQt](qapplication.html#aboutQt)( ) 。 ``` QMessageBox.addButton (self, QAbstractButton?button, ButtonRole?role) ``` 該_button_說法有它的所有權轉移給Qt的。 將給定_button_與指定的消息框_role_。 這個函數中引入了Qt 4.2中。 **See also** [removeButton](qmessagebox.html#removeButton)( )[button](qmessagebox.html#button)()和[setStandardButtons](qmessagebox.html#standardButtons-prop)( ) 。 ``` QPushButton QMessageBox.addButton (self, QString?text, ButtonRole?role) ``` [ 這是一個重載函數。 創建一個按鈕,用給定的_text_,把它添加到指定的消息框_role_,并將其返回。 這個函數中引入了Qt 4.2中。 ](qpushbutton.html) ``` QPushButton QMessageBox.addButton (self, StandardButton?button) ``` [ 這是一個重載函數。 增加了一個標準_button_到消息框,如果它是有效的話,返回按鈕。 這個函數中引入了Qt 4.2中。 ](qpushbutton.html) [**See also**](qpushbutton.html) [setStandardButtons](qmessagebox.html#standardButtons-prop)( ) 。 ``` QAbstractButton QMessageBox.button (self, StandardButton?which) ``` [ 返回對應于標準按鈕的指針_which_,或者0,如果標準按鈕不能在此消息框存在。 這個函數中引入了Qt 4.2中。 ](qabstractbutton.html) [**See also**](qabstractbutton.html) [standardButtons](qmessagebox.html#standardButtons-prop)和[standardButton](qmessagebox.html#standardButton)( ) 。 ``` ButtonRole QMessageBox.buttonRole (self, QAbstractButton?button) ``` [](qmessagebox.html#ButtonRole-enum) [返回指定按鈕的作用_button_。這個函數返回](qmessagebox.html#ButtonRole-enum)[InvalidRole](qmessagebox.html#ButtonRole-enum)如果_button_為0或還沒有被添加到消息框。 此功能被引入Qt的4.5 。 **See also** [buttons](qmessagebox.html#buttons)()和[addButton](qmessagebox.html#addButton)( ) 。 ``` list-of-QAbstractButton QMessageBox.buttons (self) ``` 返回所有已添加到消息框按鈕的列表。 此功能被引入Qt的4.5 。 **See also** [buttonRole](qmessagebox.html#buttonRole)( )[addButton](qmessagebox.html#addButton)()和[removeButton](qmessagebox.html#removeButton)( ) 。 ``` QString QMessageBox.buttonText (self, int?button) ``` ``` QMessageBox.changeEvent (self, QEvent) ``` 從重新實現[QWidget.changeEvent](qwidget.html#changeEvent)( ) 。 ``` QAbstractButton QMessageBox.clickedButton (self) ``` [](qabstractbutton.html) [返回由用戶,或0點擊,如果用戶擊中按鈕**Esc**鍵和無](qabstractbutton.html)[escape button](qmessagebox.html#setEscapeButton)設置。 If [exec_](qmessagebox.html#exec)( )沒有被調用尚未返回0。 例如: ``` [QMessageBox](qmessagebox.html) messageBox(this); [QAbstractButton](qabstractbutton.html) *disconnectButton = messageBox.addButton(tr("Disconnect"), [QMessageBox](qmessagebox.html).ActionRole); ... messageBox.exec_(); if (messageBox.clickedButton() == disconnectButton) { ... } ``` 這個函數中引入了Qt 4.2中。 **See also** [standardButton](qmessagebox.html#standardButton)()和[button](qmessagebox.html#button)( ) 。 ``` QMessageBox.closeEvent (self, QCloseEvent) ``` 從重新實現[QWidget.closeEvent](qwidget.html#closeEvent)( ) 。 ``` StandardButton QMessageBox.critical (QWidget?parent, QString?title, QString?text, StandardButtons?buttons?=?QMessageBox.Ok, StandardButton?defaultButton?=?QMessageBox.NoButton) ``` [ 打開一個重要的消息框,用給定的_title_和_text_在指定的前_parent_小工具。 ](qmessagebox.html#StandardButton-enum) [標準_buttons_添加到消息框。_defaultButton_指定用于當按鈕**Enter**被按下。_defaultButton_必須提及的是在給定的一個按鈕_buttons_。如果_defaultButton_ is](qmessagebox.html#StandardButton-enum) [QMessageBox.NoButton](qmessagebox.html#StandardButton-enum),[QMessageBox](qmessagebox.html)自動選擇一個合適的默認值。 返回被點擊的標準按鈕的標識。如果**Esc**被按下而,[escape button](qmessagebox.html#default-and-escape-keys)返回。 該消息框是一個[application modal](qt.html#WindowModality-enum)對話框。 **Warning:**不要刪除_parent_在該對話框的執行。如果你想這樣做,你應該用一個自己創建的對話框[QMessageBox](qmessagebox.html)構造函數。 這個函數中引入了Qt 4.2中。 **See also** [question](qmessagebox.html#question)( )[warning](qmessagebox.html#warning)()和[information](qmessagebox.html#information)( ) 。 ``` int QMessageBox.critical (QWidget?parent, QString?title, QString?text, int?button0, int?button1, int?button2?=?0) ``` ``` int QMessageBox.critical (QWidget?parent, QString?title, QString?text, QString?button0Text, QString?button1Text?=?QString(), QString?button2Text?=?QString(), int?defaultButtonNumber?=?0, int?escapeButtonNumber?=?-1) ``` ``` QPushButton QMessageBox.defaultButton (self) ``` [](qpushbutton.html) [返回按鈕應該是這樣的消息框的](qpushbutton.html)[default button](qpushbutton.html#default-prop)。返回0,如果是沒有設置默認按鈕。 這個函數中引入了Qt 4.2中。 **See also** [setDefaultButton](qmessagebox.html#setDefaultButton)( )[addButton](qmessagebox.html#addButton)()和[QPushButton.setDefault](qpushbutton.html#default-prop)( ) 。 ``` QString QMessageBox.detailedText (self) ``` ``` QAbstractButton QMessageBox.escapeButton (self) ``` [ 返回逃跑時被按下了啟動按鈕。 ](qabstractbutton.html) [默認情況下,](qabstractbutton.html)[QMessageBox](qmessagebox.html)嘗試自動檢測逃生按鈕,如下所示: 1. 如果只有一個鍵,它是由逸出按鈕。 2. 如果有一個[Cancel](qmessagebox.html#StandardButton-enum)按鈕,它是由退出按鈕。 3. 在Mac OS X只,如果恰好有一個按鈕的作用[QMessageBox.RejectRole](qmessagebox.html#ButtonRole-enum),它是由退出按鈕。 如果不能自動檢測到一個轉義按鈕,按下**Esc**沒有任何影響。 這個函數中引入了Qt 4.2中。 **See also** [setEscapeButton](qmessagebox.html#setEscapeButton)()和[addButton](qmessagebox.html#addButton)( ) 。 ``` bool QMessageBox.event (self, QEvent?e) ``` 從重新實現[QObject.event](qobject.html#event)( ) 。 ``` Icon QMessageBox.icon (self) ``` [](qmessagebox.html#Icon-enum) ``` QPixmap QMessageBox.iconPixmap (self) ``` [](qpixmap.html) ``` StandardButton QMessageBox.information (QWidget?parent, QString?title, QString?text, StandardButtons?buttons?=?QMessageBox.Ok, StandardButton?defaultButton?=?QMessageBox.NoButton) ``` [ 打開一個信息的消息框與給定_title_和_text_在指定的前_parent_小工具。 ](qmessagebox.html#StandardButton-enum) [標準_buttons_添加到消息框。_defaultButton_指定用于當按鈕**Enter**被按下。_defaultButton_必須提及的是在給定的一個按鈕_buttons_。如果_defaultButton_ is](qmessagebox.html#StandardButton-enum) [QMessageBox.NoButton](qmessagebox.html#StandardButton-enum),[QMessageBox](qmessagebox.html)自動選擇一個合適的默認值。 返回被點擊的標準按鈕的標識。如果**Esc**被按下而,[escape button](qmessagebox.html#default-and-escape-keys)返回。 該消息框是一個[application modal](qt.html#WindowModality-enum)對話框。 **Warning:**不要刪除_parent_在該對話框的執行。如果你想這樣做,你應該用一個自己創建的對話框[QMessageBox](qmessagebox.html)構造函數。 這個函數中引入了Qt 4.2中。 **See also** [question](qmessagebox.html#question)( )[warning](qmessagebox.html#warning)()和[critical](qmessagebox.html#critical)( ) 。 ``` int QMessageBox.information (QWidget?parent, QString?title, QString?text, int?button0, int?button1?=?0, int?button2?=?0) ``` ``` int QMessageBox.information (QWidget?parent, QString?title, QString?text, QString?button0Text, QString?button1Text?=?QString(), QString?button2Text?=?QString(), int?defaultButtonNumber?=?0, int?escapeButtonNumber?=?-1) ``` ``` QString QMessageBox.informativeText (self) ``` ``` QMessageBox.keyPressEvent (self, QKeyEvent) ``` 從重新實現[QWidget.keyPressEvent](qwidget.html#keyPressEvent)( ) 。 ``` QMessageBox.open (self) ``` 這是一個重載函數。 在打開的對話框并連接其[finished](qdialog.html#finished)()或[buttonClicked](qmessagebox.html#buttonClicked)()信號到由指定的槽_receiver_和_member_。如果在槽_member_有一個指針,它的第一個參數的連接是[buttonClicked](qmessagebox.html#buttonClicked)( ),否則該連接是[finished](qdialog.html#finished)( ) 。 該信號會從插槽中斷開時,關閉對話框。 ``` QMessageBox.open (self, QObject?receiver, SLOT()SLOT()?member) ``` ``` QMessageBox.open (self, callable?receiver) ``` ``` StandardButton QMessageBox.question (QWidget?parent, QString?title, QString?text, StandardButtons?buttons?=?QMessageBox.Ok, StandardButton?defaultButton?=?QMessageBox.NoButton) ``` [ 打開一個疑問消息框,用給定的_title_和_text_在指定的前_parent_小工具。 ](qmessagebox.html#StandardButton-enum) [標準_buttons_添加到消息框。_defaultButton_指定用于當按鈕**Enter**被按下。_defaultButton_必須提及的是在給定的一個按鈕_buttons_。如果_defaultButton_ is](qmessagebox.html#StandardButton-enum) [QMessageBox.NoButton](qmessagebox.html#StandardButton-enum),[QMessageBox](qmessagebox.html)自動選擇一個合適的默認值。 返回被點擊的標準按鈕的標識。如果**Esc**被按下而,[escape button](qmessagebox.html#default-and-escape-keys)返回。 該消息框是一個[application modal](qt.html#WindowModality-enum)對話框。 **Warning:**不要刪除_parent_在該對話框的執行。如果你想這樣做,你應該用一個自己創建的對話框[QMessageBox](qmessagebox.html)構造函數。 這個函數中引入了Qt 4.2中。 **See also** [information](qmessagebox.html#information)( )[warning](qmessagebox.html#warning)()和[critical](qmessagebox.html#critical)( ) 。 ``` int QMessageBox.question (QWidget?parent, QString?title, QString?text, int?button0, int?button1?=?0, int?button2?=?0) ``` ``` int QMessageBox.question (QWidget?parent, QString?title, QString?text, QString?button0Text, QString?button1Text?=?QString(), QString?button2Text?=?QString(), int?defaultButtonNumber?=?0, int?escapeButtonNumber?=?-1) ``` ``` QMessageBox.removeButton (self, QAbstractButton?button) ``` 該_button_爭論 移除_button_從而不刪除它的按鈕盒。 這個函數中引入了Qt 4.2中。 **See also** [addButton](qmessagebox.html#addButton)()和[setStandardButtons](qmessagebox.html#standardButtons-prop)( ) 。 ``` QMessageBox.resizeEvent (self, QResizeEvent) ``` 從重新實現[QWidget.resizeEvent](qwidget.html#resizeEvent)( ) 。 ``` QMessageBox.setButtonText (self, int?button, QString) ``` ``` QMessageBox.setDefaultButton (self, QPushButton?button) ``` 設置消息框的[default button](qpushbutton.html#default-prop)至_button_。 這個函數中引入了Qt 4.2中。 **See also** [defaultButton](qmessagebox.html#defaultButton)( )[addButton](qmessagebox.html#addButton)()和[QPushButton.setDefault](qpushbutton.html#default-prop)( ) 。 ``` QMessageBox.setDefaultButton (self, StandardButton?button) ``` 設置消息框的[default button](qpushbutton.html#default-prop)至_button_。 此功能被引入Qt的4.3 。 **See also** [addButton](qmessagebox.html#addButton)()和[QPushButton.setDefault](qpushbutton.html#default-prop)( ) 。 ``` QMessageBox.setDetailedText (self, QString?text) ``` ``` QMessageBox.setEscapeButton (self, QAbstractButton?button) ``` 設置被激活??按鈕時**Escape**鍵被按下_button_。 這個函數中引入了Qt 4.2中。 **See also** [escapeButton](qmessagebox.html#escapeButton)( )[addButton](qmessagebox.html#addButton)()和[clickedButton](qmessagebox.html#clickedButton)( ) 。 ``` QMessageBox.setEscapeButton (self, StandardButton?button) ``` 設置被激活??的按鈕時,**Escape**鍵被按下_button_。 此功能被引入Qt的4.3 。 **See also** [addButton](qmessagebox.html#addButton)()和[clickedButton](qmessagebox.html#clickedButton)( ) 。 ``` QMessageBox.setIcon (self, Icon) ``` ``` QMessageBox.setIconPixmap (self, QPixmap) ``` ``` QMessageBox.setInformativeText (self, QString?text) ``` ``` QMessageBox.setStandardButtons (self, StandardButtons?buttons) ``` ``` QMessageBox.setText (self, QString) ``` ``` QMessageBox.setTextFormat (self, Qt.TextFormat) ``` ``` QMessageBox.setWindowModality (self, Qt.WindowModality?windowModality) ``` 該功能的陰影[QWidget.setWindowModality](qwidget.html#windowModality-prop)( ) 。 設置消息框的樣式,以_windowModality_。 在Mac OS X中,如果模式設置為[Qt.WindowModal](qt.html#WindowModality-enum)并且該消息框有父,則消息框將是一個[Qt.Sheet](qt.html#WindowType-enum),否則,消息框將是一個標準的對話框。 這個函數中引入了Qt 4.2中。 ``` QMessageBox.setWindowTitle (self, QString?title) ``` 該功能的陰影[QWidget.setWindowTitle](qwidget.html#windowTitle-prop)( ) 。 設置消息框的標題_title_。在Mac OS X ,窗口標題將被忽略(如需要Mac OS X的指引) 。 這個函數中引入了Qt 4.2中。 ``` QMessageBox.showEvent (self, QShowEvent) ``` 從重新實現[QWidget.showEvent](qwidget.html#showEvent)( ) 。 ``` QSize QMessageBox.sizeHint (self) ``` [](qsize.html) ``` StandardButton QMessageBox.standardButton (self, QAbstractButton?button) ``` [](qmessagebox.html#StandardButton-enum) [返回對應于給定的標準按鈕枚舉值_button_或](qmessagebox.html#StandardButton-enum)[NoButton](qmessagebox.html#StandardButton-enum)如果給定的_button_不是一個標準的按鈕。 這個函數中引入了Qt 4.2中。 **See also** [button](qmessagebox.html#button)()和[standardButtons](qmessagebox.html#standardButtons-prop)( ) 。 ``` StandardButtons QMessageBox.standardButtons (self) ``` [](index.htm) ``` QPixmap QMessageBox.standardIcon (Icon?icon) ``` [ ``` QString QMessageBox.text (self) ``` ](qpixmap.html) ``` Qt.TextFormat QMessageBox.textFormat (self) ``` [](qt.html#TextFormat-enum) ``` StandardButton QMessageBox.warning (QWidget?parent, QString?title, QString?text, StandardButtons?buttons?=?QMessageBox.Ok, StandardButton?defaultButton?=?QMessageBox.NoButton) ``` [ 打開一個警告消息框與給定_title_和_text_在指定的前_parent_小工具。 ](qmessagebox.html#StandardButton-enum) [標準_buttons_添加到消息框。_defaultButton_指定用于當按鈕**Enter**被按下。_defaultButton_必須提及的是在給定的一個按鈕_buttons_。如果_defaultButton_ is](qmessagebox.html#StandardButton-enum) [QMessageBox.NoButton](qmessagebox.html#StandardButton-enum),[QMessageBox](qmessagebox.html)自動選擇一個合適的默認值。 返回被點擊的標準按鈕的標識。如果**Esc**被按下而,[escape button](qmessagebox.html#default-and-escape-keys)返回。 該消息框是一個[application modal](qt.html#WindowModality-enum)對話框。 **Warning:**不要刪除_parent_在該對話框的執行。如果你想這樣做,你應該用一個自己創建的對話框[QMessageBox](qmessagebox.html)構造函數。 這個函數中引入了Qt 4.2中。 **See also** [question](qmessagebox.html#question)( )[information](qmessagebox.html#information)()和[critical](qmessagebox.html#critical)( ) 。 ``` int QMessageBox.warning (QWidget?parent, QString?title, QString?text, int?button0, int?button1, int?button2?=?0) ``` ``` int QMessageBox.warning (QWidget?parent, QString?title, QString?text, QString?button0Text, QString?button1Text?=?QString(), QString?button2Text?=?QString(), int?defaultButtonNumber?=?0, int?escapeButtonNumber?=?-1) ``` * * * ## Qt Signal Documentation ``` void buttonClicked (QAbstractButton *) ``` 這是該信號的默認超載。 每當一個按鈕被點擊里面的這個信號被發射[QMessageBox](qmessagebox.html)。被點擊在返回的按鈕_button_。
                  <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>

                              哎呀哎呀视频在线观看