<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # QPushButton Class Reference ## [[QtGui](index.htm) module] 該QPushButton窗口部件提供了一個命令按鈕。[More...](#details) 繼承[QAbstractButton](qabstractbutton.html)。 通過繼承[QCommandLinkButton](qcommandlinkbutton.html)。 ### Methods * `__init__ (self, QWidget?parent?=?None)` * `__init__ (self, QString?text, QWidget?parent?=?None)` * `__init__ (self, QIcon?icon, QString?text, QWidget?parent?=?None)` * `bool autoDefault (self)` * `bool event (self, QEvent?e)` * `focusInEvent (self, QFocusEvent)` * `focusOutEvent (self, QFocusEvent)` * `initStyleOption (self, QStyleOptionButton?option)` * `bool isDefault (self)` * `bool isFlat (self)` * `keyPressEvent (self, QKeyEvent)` * `QMenu menu (self)` * `QSize minimumSizeHint (self)` * `paintEvent (self, QPaintEvent)` * `setAutoDefault (self, bool)` * `setDefault (self, bool)` * `setFlat (self, bool)` * `setMenu (self, QMenu?menu)` * `showMenu (self)` * `QSize sizeHint (self)` * * * ## Detailed Description 該QPushButton窗口部件提供了一個命令按鈕。 按鈕或命令按鈕,也許是任何圖形用戶界面中最常用的部件。推(點擊)按鈕來命令計算機執行某些操作,或回答一個問題。典型的按鈕是確定,應用,取消,關閉,是,否和幫助。 一個命令按鈕是長方形,通常會顯示描述其操作的文本標籤。快捷鍵可以首選使用的字符在文本中的&符號前面的指定。例如: ``` QPushButton *button = new QPushButton("&Download", this); ``` 在這個例子中,快捷鍵是_Alt+D_。請參閱[QShortcut](qshortcut.html#mnemonic)有關詳細信息的文檔(顯示的實際符號,使用“\u0026\u0026” ) 。 按鈕顯示文本標籤,以及可選的小圖標。這些可以通過構造函數來設置和使用后來改[setText](qabstractbutton.html#text-prop)()和[setIcon](qabstractbutton.html#icon-prop)( ) 。如果禁用該按鈕上的文字和圖標的外觀將會被操縱方面的圖形用戶界面風格,使按鈕看起來“已禁用” 。 一個按鈕發出的信號[clicked](qabstractbutton.html#clicked)()時,它是由鼠標,空格鍵或鍵盤快捷方式激活。連接到這個信號來執行按鈕的操作。推動按鈕也提供不太常用的信號,例如,[pressed](qabstractbutton.html#pressed)()和[released](qabstractbutton.html#released)( ) 。 在對話框的命令按鈕是默認自動默認按鈕,即會自動成為默認的按鈕,當他們收到的鍵盤輸入焦點。默認按鈕是一個按鈕,當用戶按下Enter鍵或Return鍵在對話框被激活。您可以更改此[setAutoDefault](qpushbutton.html#autoDefault-prop)( ) 。需要注意的是自動默認按鈕保留一點點額外的空間,它是要訂一個默認按鈕指示燈。如果你不想在你的按鈕這個空間,調用setAutoDefault (假) 。 由于酒店地處中央,按鈕控件已經成長為容納了大量的變化,在過去的十年。微軟風格指南現在顯示的Windows按鈕約十個不同國家和文本意味著有幾十個,當的特征的所有組合都考慮到了。 最重要的模式或狀態是: * Available or not (grayed out, disabled). * Standard push button, toggling push button or menu button. * On or off (only for toggling push buttons). * Default or normal. The default button in a dialog can generally be "clicked" using the Enter or Return key. * Auto-repeat or not. * Pressed down or not. 作為一般規則,使用一個按鈕時,應用程序或對話框窗口,當用戶點擊它執行一個動作(如適用,取消,關閉和幫助)_and_當插件被認為具有廣泛的,矩形的形狀,文本標籤。小,一般方形按鈕,改變窗口的狀態,而不是執行中的的右上角一個動作(如按鈕[QFileDialog](qfiledialog.html))沒有命令按鈕,但工具按鈕。 Qt提供了一個特殊的類([QToolButton](qtoolbutton.html)),這些按鈕。 如果你需要切換行為(見[setCheckable](qabstractbutton.html#checkable-prop)())或者一個按鈕,自動重復啟動信號時被按下一樣在滾動條中的箭頭(參見[setAutoRepeat](qabstractbutton.html#autoRepeat-prop)( ) ) ,一個命令按鈕可能不是你想要的。當有疑問時,可使用的工具按鈕。 命令按鈕的變化是菜單按鈕。它們提供的不只是一個命令,但是有幾個,因為他們被點擊時,彈出一個選項菜單。使用方法[setMenu](qpushbutton.html#setMenu)( )一個彈出菜單與按鈕相關聯。 其他類的按鈕選項按鈕(請參閱[QRadioButton](qradiobutton.html))和復選框(見[QCheckBox](qcheckbox.html)) 。 | ![Screenshot of a Macintosh style push button](https://img.kancloud.cn/ef/50/ef50c88d3343e3c8914c499dca9dae84_93x44.png) | A push button shown in the [Macintosh widget style](index.htm).請注意,當一個按鈕的寬度變得小于50或它的高度變得比30小,按鈕的角被改變從圓形到方形。使用[setMinimumSize](qwidget.html#minimumSize-prop)( )函數來防止這種行為。 | | ![Screenshot of a Windows XP style push button](https://img.kancloud.cn/ef/e7/efe70d36a8816a33a9a5ac9f9c0c4b77_89x37.png) | A push button shown in the [Windows XP widget style](index.htm). | | ![Screenshot of a Plastique style push button](https://img.kancloud.cn/9d/53/9d538c27de98d5f8ceea0ecbe1c28e20_99x41.png) | A push button shown in the [Plastique widget style](index.htm). | 在Qt中,[QAbstractButton](qabstractbutton.html)基類提供了大部分的模式和其他的API ,和QPushButton提供GUI邏輯。看[QAbstractButton](qabstractbutton.html)有關API的詳細信息。 * * * ## Method Documentation ``` QPushButton.__init__ (self, QWidget?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個按鈕,沒有文字和_parent_。 ``` QPushButton.__init__ (self, QString?text, QWidget?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個按鈕與父_parent_和文本_text_。 ``` QPushButton.__init__ (self, QIcon?icon, QString?text, QWidget?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個按鈕用_icon_和_text_和_parent_。 請注意,您也可以通過一個[QPixmap](qpixmap.html)對象為一個圖標(這要歸功于C + +中提供的隱式類型轉換) 。 ``` bool QPushButton.autoDefault (self) ``` ``` bool QPushButton.event (self, QEvent?e) ``` 從重新實現[QObject.event](qobject.html#event)( ) 。 ``` QPushButton.focusInEvent (self, QFocusEvent) ``` 從重新實現[QWidget.focusInEvent](qwidget.html#focusInEvent)( ) 。 ``` QPushButton.focusOutEvent (self, QFocusEvent) ``` 從重新實現[QWidget.focusOutEvent](qwidget.html#focusOutEvent)( ) 。 ``` QPushButton.initStyleOption (self, QStyleOptionButton?option) ``` 初始化_option_與其它的值[QPushButton](qpushbutton.html)。當他們需要一個這種方法是有用的子類[QStyleOptionButton](qstyleoptionbutton.html),但不希望在所有的信息填寫自己。 **See also** [QStyleOption.initFrom](qstyleoption.html#initFrom)( ) 。 ``` bool QPushButton.isDefault (self) ``` ``` bool QPushButton.isFlat (self) ``` ``` QPushButton.keyPressEvent (self, QKeyEvent) ``` 從重新實現[QWidget.keyPressEvent](qwidget.html#keyPressEvent)( ) 。 ``` QMenu QPushButton.menu (self) ``` [ 返回按鈕相關的彈出菜單或0 ,如果沒有彈出式菜單已設置。 ](qmenu.html) [**See also**](qmenu.html) [setMenu](qpushbutton.html#setMenu)( ) 。 ``` QSize QPushButton.minimumSizeHint (self) ``` [](qsize.html) [從重新實現](qsize.html)[QWidget.minimumSizeHint](qwidget.html#minimumSizeHint-prop)( ) 。 ``` QPushButton.paintEvent (self, QPaintEvent) ``` 從重新實現[QWidget.paintEvent](qwidget.html#paintEvent)( ) 。 ``` QPushButton.setAutoDefault (self, bool) ``` ``` QPushButton.setDefault (self, bool) ``` ``` QPushButton.setFlat (self, bool) ``` ``` QPushButton.setMenu (self, QMenu?menu) ``` 關聯彈出菜單_menu_與此按鈕。這將打開該按鈕的菜單按鈕,這在一些風格會產生一個小三角按鈕的文本的右側。 菜單的所有權_not_轉移到按鈕。 | ![Screenshot of a Plastique style push button with popup menu.](https://img.kancloud.cn/1e/41/1e4161f1e2f7189f114150a08e943ff7_130x137.png) | ![Screenshot of a Cleanlooks style push button with popup menu.](https://img.kancloud.cn/ad/e8/ade81fc467569bf9c81830f13ee11e68_130x137.png) | Push buttons with popup menus shown in the [Plastique widget style](index.htm) (left) and [Cleanlooks widget style](index.htm) (right). | **See also** [menu](qpushbutton.html#menu)( ) 。 ``` QPushButton.showMenu (self) ``` 這種方法也是一個Qt槽與C + +的簽名`void showMenu()`。 顯示(彈出)相關的彈出式菜單。如果沒有這樣的菜單,這個函數什么都不做。此函數不返回,直到彈出菜單已經被用戶關閉。 ``` QSize QPushButton.sizeHint (self) ``` [](qsize.html) [從重新實現](qsize.html)[QWidget.sizeHint](qwidget.html#sizeHint-prop)( ) 。
                  <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>

                              哎呀哎呀视频在线观看