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

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # QAbstractButton Class Reference ## [[QtGui](index.htm) module] 該QAbstractButton類是按鈕控件的抽象基類,提供了常見的按鍵功能。[More...](#details) 繼承[QWidget](qwidget.html)。 通過繼承[QCheckBox](qcheckbox.html),[QPushButton](qpushbutton.html),[QRadioButton](qradiobutton.html)和[QToolButton](qtoolbutton.html)。 ### Methods * `__init__ (self, QWidget?parent?=?None)` * `animateClick (self, int?msecs?=?100)` * `bool autoExclusive (self)` * `bool autoRepeat (self)` * `int autoRepeatDelay (self)` * `int autoRepeatInterval (self)` * `changeEvent (self, QEvent?e)` * `checkStateSet (self)` * `click (self)` * `bool event (self, QEvent?e)` * `focusInEvent (self, QFocusEvent?e)` * `focusOutEvent (self, QFocusEvent?e)` * `QButtonGroup group (self)` * `bool hitButton (self, QPoint?pos)` * `QIcon icon (self)` * `QSize iconSize (self)` * `bool isCheckable (self)` * `bool isChecked (self)` * `bool isDown (self)` * `keyPressEvent (self, QKeyEvent?e)` * `keyReleaseEvent (self, QKeyEvent?e)` * `mouseMoveEvent (self, QMouseEvent?e)` * `mousePressEvent (self, QMouseEvent?e)` * `mouseReleaseEvent (self, QMouseEvent?e)` * `nextCheckState (self)` * `paintEvent (self, QPaintEvent?e)` * `setAutoExclusive (self, bool)` * `setAutoRepeat (self, bool)` * `setAutoRepeatDelay (self, int)` * `setAutoRepeatInterval (self, int)` * `setCheckable (self, bool)` * `setChecked (self, bool)` * `setDown (self, bool)` * `setIcon (self, QIcon?icon)` * `setIconSize (self, QSize?size)` * `setShortcut (self, QKeySequence?key)` * `setText (self, QString?text)` * `QKeySequence shortcut (self)` * `QString text (self)` * `timerEvent (self, QTimerEvent?e)` * `toggle (self)` ### Qt Signals * `void clicked (bool = 0)` * `void pressed ()` * `void released ()` * `void toggled (bool)` * * * ## Detailed Description 該QAbstractButton類是按鈕控件的抽象基類,提供了常見的按鍵功能。 這個類實現了一個_abstract_按鈕。這個類處理用戶動作的子類,并指定該按鈕的繪制方式。 QAbstractButton提供了兩個按鍵和可復(切換)按鈕的支持。辨認的按鈕在實施[QRadioButton](qradiobutton.html)和[QCheckBox](qcheckbox.html)類。按鈕是在實施[QPushButton](qpushbutton.html)和[QToolButton](qtoolbutton.html)類,這些還提供切換行為,如果需要的話。 任何按鈕可以顯示一個包含標籤文本和圖標。[setText](qabstractbutton.html#text-prop)( )設置文本;[setIcon](qabstractbutton.html#icon-prop)()設置的圖標。如果被禁用的按鈕,其標籤更改為給按鈕“已禁用”的外觀。 如果按鈕是一個按鈕的文本包含一個連字號( '&' )的字符串, QAbstractButton會自動創建一個快捷鍵。例如: ``` [QPushButton](qpushbutton.html) *button = new [QPushButton](qpushbutton.html)(tr("Ro&ck && Roll"), this); ``` 該**Alt+C**快捷方式被分配給該按鈕時,即,當用戶按下**Alt+C**該按鈕將調用[animateClick](qabstractbutton.html#animateClick)( ) 。請參閱[QShortcut](qshortcut.html#mnemonic)有關詳細信息的文檔(顯示的實際符號,使用“\u0026\u0026” ) 。 您還可以使用設置自定義快捷鍵[setShortcut](qabstractbutton.html#shortcut-prop)()函數。這主要是針對那些沒有任何文字按鈕非常有用,因為它們沒有自動的快捷方式。 ``` button->setIcon([QIcon](qicon.html)(":/../img/print.png")); button->setShortcut(tr("Alt+F7")); ``` 所有Qt提供的按鈕([QPushButton](qpushbutton.html),[QToolButton](qtoolbutton.html),[QCheckBox](qcheckbox.html)和[QRadioButton](qradiobutton.html))可以同時顯示[text](qabstractbutton.html#text-prop)和[icons](qabstractbutton.html#icon-prop)。 A鍵可在對話框中的默認按鈕是由提供[QPushButton.setDefault](qpushbutton.html#default-prop)()和[QPushButton.setAutoDefault](qpushbutton.html#autoDefault-prop)( ) 。 QAbstractButton提供了最常用的按鈕的狀態: * [isDown](qabstractbutton.html#down-prop)() indicates whether the button is _pressed_ down. * [isChecked](qabstractbutton.html#checked-prop)() indicates whether the button is _checked_. Only checkable buttons can be checked and unchecked (see below). * [isEnabled](qwidget.html#enabled-prop)() indicates whether the button can be pressed by the user. **Note:** As opposed to other widgets, buttons derived from QAbstractButton accepts mouse and context menu events when disabled. * [setAutoRepeat](qabstractbutton.html#autoRepeat-prop)() sets whether the button will auto-repeat if the user holds it down. [autoRepeatDelay](qabstractbutton.html#autoRepeatDelay-prop) and [autoRepeatInterval](qabstractbutton.html#autoRepeatInterval-prop) define how auto-repetition is done. * [setCheckable](qabstractbutton.html#checkable-prop)() sets whether the button is a toggle button or not. 之間的差[isDown](qabstractbutton.html#down-prop)()和[isChecked](qabstractbutton.html#checked-prop)()如下。當用戶點擊切換按鈕來檢查它,按鈕是第一_pressed_然后釋放到_checked_狀態。當用戶再次單擊它(取消選中它) ,按鈕首先移動到_pressed_狀態,然后到_unchecked_狀態([isChecked](qabstractbutton.html#checked-prop)()和[isDown](qabstractbutton.html#down-prop)( )都是假的) 。 QAbstractButton提供四個信號: 1. [pressed](qabstractbutton.html#pressed)( )當按下鼠標左鍵,當鼠標指針在按鈕內發出。 2. [released](qabstractbutton.html#released)( )當釋放鼠標左鍵發射。 3. [clicked](qabstractbutton.html#clicked)()時,當第一次按下,然后釋放按鈕,當快捷鍵被鍵入時,或者當發射[click](qabstractbutton.html#click)()或[animateClick](qabstractbutton.html#animateClick)()被調用。 4. [toggled](qabstractbutton.html#toggled)( )被發射時的切換按鈕的狀態發生改變。 子類QAbstractButton ,你必須重新實現至少[paintEvent](qabstractbutton.html#paintEvent)( )來繪制按鈕的輪廓和它的文本或像素圖。通常建議重新實現[sizeHint](qwidget.html#sizeHint-prop)( )為好,有時[hitButton](qabstractbutton.html#hitButton)( ) (判斷按下一個按鈕是否在按鈕內) 。對于有兩個以上的國家(如三態按鈕)按鈕,您也必須重新實現[checkStateSet](qabstractbutton.html#checkStateSet)()和[nextCheckState](qabstractbutton.html#nextCheckState)( ) 。 * * * ## Method Documentation ``` QAbstractButton.__init__ (self, QWidget?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個抽象的按鈕與_parent_。 ``` QAbstractButton.animateClick (self, int?msecs?=?100) ``` 這種方法也是一個Qt槽與C + +的簽名`void animateClick(int = 100)`。 執行一個動畫點擊:按鈕被按下馬上,并釋放_msec_毫秒后(默認為100毫秒) 。 再次調用此功能的按鈕被釋放之前將復位釋放定時器。 與點擊相關的所有信號都發出適當。 這個函數不執行任何操作,如果該按鈕是[disabled.](qwidget.html#enabled-prop) **See also** [click](qabstractbutton.html#click)( ) 。 ``` bool QAbstractButton.autoExclusive (self) ``` ``` bool QAbstractButton.autoRepeat (self) ``` ``` int QAbstractButton.autoRepeatDelay (self) ``` ``` int QAbstractButton.autoRepeatInterval (self) ``` ``` QAbstractButton.changeEvent (self, QEvent?e) ``` 從重新實現[QWidget.changeEvent](qwidget.html#changeEvent)( ) 。 ``` QAbstractButton.checkStateSet (self) ``` 這種虛擬處理器被調用時[setChecked](qabstractbutton.html#checked-prop)( )被調用,除非它是從內部調用[nextCheckState](qabstractbutton.html#nextCheckState)( ) 。它允許子類重新設置他們的中間按鈕狀態。 **See also** [nextCheckState](qabstractbutton.html#nextCheckState)( ) 。 ``` QAbstractButton.click (self) ``` 這種方法也是一個Qt槽與C + +的簽名`void click()`。 進行點擊。 所有與點擊相關的一般信號被發射(如適用) 。如果按鈕是可復,按鈕的狀態翻轉。 這個函數不執行任何操作,如果該按鈕是[disabled.](qwidget.html#enabled-prop) **See also** [animateClick](qabstractbutton.html#animateClick)( ) 。 ``` bool QAbstractButton.event (self, QEvent?e) ``` 從重新實現[QObject.event](qobject.html#event)( ) 。 ``` QAbstractButton.focusInEvent (self, QFocusEvent?e) ``` 從重新實現[QWidget.focusInEvent](qwidget.html#focusInEvent)( ) 。 ``` QAbstractButton.focusOutEvent (self, QFocusEvent?e) ``` 從重新實現[QWidget.focusOutEvent](qwidget.html#focusOutEvent)( ) 。 ``` QButtonGroup QAbstractButton.group (self) ``` [ 返回此按鈕所屬的組。 ](qbuttongroup.html) [如果按鈕沒有任何一個成員](qbuttongroup.html)[QButtonGroup](qbuttongroup.html),這個函數返回0 。 **See also** [QButtonGroup](qbuttongroup.html)。 ``` bool QAbstractButton.hitButton (self, QPoint?pos) ``` 返回True如果_pos_是可點擊的按鈕矩形內,否則返回False 。 默認情況下,可點擊區域是整個窗口部件。子類可以重新實現此功能,以提供不同形狀和尺寸的可點擊區域的支持。 ``` QIcon QAbstractButton.icon (self) ``` [](qicon.html) ``` QSize QAbstractButton.iconSize (self) ``` [ ``` bool QAbstractButton.isCheckable (self) ``` ``` bool QAbstractButton.isChecked (self) ``` ``` bool QAbstractButton.isDown (self) ``` ``` QAbstractButton.keyPressEvent (self, QKeyEvent?e) ``` ](qsize.html) [從重新實現](qsize.html)[QWidget.keyPressEvent](qwidget.html#keyPressEvent)( ) 。 ``` QAbstractButton.keyReleaseEvent (self, QKeyEvent?e) ``` 從重新實現[QWidget.keyReleaseEvent](qwidget.html#keyReleaseEvent)( ) 。 ``` QAbstractButton.mouseMoveEvent (self, QMouseEvent?e) ``` 從重新實現[QWidget.mouseMoveEvent](qwidget.html#mouseMoveEvent)( ) 。 ``` QAbstractButton.mousePressEvent (self, QMouseEvent?e) ``` 從重新實現[QWidget.mousePressEvent](qwidget.html#mousePressEvent)( ) 。 ``` QAbstractButton.mouseReleaseEvent (self, QMouseEvent?e) ``` 從重新實現[QWidget.mouseReleaseEvent](qwidget.html#mouseReleaseEvent)( ) 。 ``` QAbstractButton.nextCheckState (self) ``` 一個按鈕被點擊時,這個虛擬處理器被調用。默認實現調用setChecked ( ![isChecked](qabstractbutton.html#checked-prop)()) ,如果按鈕[isCheckable](qabstractbutton.html#checkable-prop)( ) 。它可以讓子類實現中間按鈕狀態。 **See also** [checkStateSet](qabstractbutton.html#checkStateSet)( ) 。 ``` QAbstractButton.paintEvent (self, QPaintEvent?e) ``` 這種方法是抽象的,應在任何子類中重新實現。 從重新實現[QWidget.paintEvent](qwidget.html#paintEvent)( ) 。 ``` QAbstractButton.setAutoExclusive (self, bool) ``` ``` QAbstractButton.setAutoRepeat (self, bool) ``` ``` QAbstractButton.setAutoRepeatDelay (self, int) ``` ``` QAbstractButton.setAutoRepeatInterval (self, int) ``` ``` QAbstractButton.setCheckable (self, bool) ``` ``` QAbstractButton.setChecked (self, bool) ``` 這種方法也是一個Qt槽與C + +的簽名`void setChecked(bool)`。 ``` QAbstractButton.setDown (self, bool) ``` ``` QAbstractButton.setIcon (self, QIcon?icon) ``` ``` QAbstractButton.setIconSize (self, QSize?size) ``` 這種方法也是一個Qt槽與C + +的簽名`void setIconSize(const QSize&)`。 ``` QAbstractButton.setShortcut (self, QKeySequence?key) ``` ``` QAbstractButton.setText (self, QString?text) ``` ``` QKeySequence QAbstractButton.shortcut (self) ``` [ ``` QString QAbstractButton.text (self) ``` ``` QAbstractButton.timerEvent (self, QTimerEvent?e) ``` ](qkeysequence.html) [從重新實現](qkeysequence.html)[QObject.timerEvent](qobject.html#timerEvent)( ) 。 ``` QAbstractButton.toggle (self) ``` 這種方法也是一個Qt槽與C + +的簽名`void toggle()`。 切換可檢查的按鈕的狀態。 **See also** [checked](qabstractbutton.html#checked-prop)。 * * * ## Qt Signal Documentation ``` void clicked (bool = 0) ``` 這是該信號的默認超載。 當按鈕被激活(即按下然后釋放當鼠標光標在按鈕內) ,當快捷鍵鍵入,或者當這個信號被發射[click](qabstractbutton.html#click)()或[animateClick](qabstractbutton.html#animateClick)()被調用。值得注意的是,該信號是_not_如果你調用發出[setDown](qabstractbutton.html#down-prop)( )[setChecked](qabstractbutton.html#checked-prop)()或[toggle](qabstractbutton.html#toggle)( ) 。 如果按鈕是可復,_checked_如果是按鈕被選中真的,還是假的,如果按鈕處于未選中狀態。 **See also** [pressed](qabstractbutton.html#pressed)( )[released](qabstractbutton.html#released)()和[toggled](qabstractbutton.html#toggled)( ) 。 ``` void pressed () ``` 這是該信號的默認超載。 當按鈕被按下時,這個信號被發射。 **See also** [released](qabstractbutton.html#released)()和[clicked](qabstractbutton.html#clicked)( ) 。 ``` void released () ``` 這是該信號的默認超載。 當按鈕被釋放這個信號被發射。 **See also** [pressed](qabstractbutton.html#pressed)( )[clicked](qabstractbutton.html#clicked)()和[toggled](qabstractbutton.html#toggled)( ) 。 ``` void toggled (bool) ``` 這是該信號的默認超載。 這個信號被發射時可檢查的按鈕改變其狀態。_checked_如果是按鈕被選中真的,還是假的,如果按鈕處于未選中狀態。 這可能是一個用戶操作的結果,[click](qabstractbutton.html#click)()槽的激活,或因為[setChecked](qabstractbutton.html#checked-prop)( )被調用。 在專屬按鈕組按鈕的狀態更新這個信號被發射之前。這意味著,槽可以在任一“關”的信號,或通過其狀態已經改變的組中的按鈕發出的“接通”信號采取行動。 例如,一個插槽,反應由新檢出的按鈕,但是它忽略來自已被取消選中使用下面的圖案可以被實現按鈕信號發射的信號: ``` void MyWidget.reactToToggle(bool checked) { if (checked) { // Examine the new button states. ... } } ``` 可以使用創建按鈕組[QButtonGroup](qbuttongroup.html)類,并更新到按鈕狀態與監視[QButtonGroup.buttonClicked](qbuttongroup.html#buttonClicked)()信號。 **See also** [checked](qabstractbutton.html#checked-prop)和[clicked](qabstractbutton.html#clicked)( ) 。
                  <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>

                              哎呀哎呀视频在线观看