<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html><head><title>QAbstractButton Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } td.postheader { font-family: sans-serif } tr.address { font-family: sans-serif } body { background: #ffffff; color: black; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QAbstractButton Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QAbstractButton class is the abstract base class of button widgets, providing functionality common to buttons. <a href="#details">More...</a></p> <p>Inherits <a href="qwidget.html">QWidget</a>.</p><p>Inherited by <a href="qcheckbox.html">QCheckBox</a>, <a href="qpushbutton.html">QPushButton</a>, <a href="qradiobutton.html">QRadioButton</a> and <a href="qtoolbutton.html">QToolButton</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qabstractbutton.html#QAbstractButton">__init__</a></b> (<i>self</i>, QWidget <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qabstractbutton.html#animateClick">animateClick</a></b> (<i>self</i>, int <i>msecs</i> = 100)</li><li><div class="fn" />bool <b><a href="qabstractbutton.html#autoExclusive">autoExclusive</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qabstractbutton.html#autoRepeat">autoRepeat</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qabstractbutton.html#autoRepeatDelay">autoRepeatDelay</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qabstractbutton.html#autoRepeatInterval">autoRepeatInterval</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractbutton.html#changeEvent">changeEvent</a></b> (<i>self</i>, QEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qabstractbutton.html#checkStateSet">checkStateSet</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractbutton.html#click">click</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qabstractbutton.html#event">event</a></b> (<i>self</i>, QEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qabstractbutton.html#focusInEvent">focusInEvent</a></b> (<i>self</i>, QFocusEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qabstractbutton.html#focusOutEvent">focusOutEvent</a></b> (<i>self</i>, QFocusEvent <i>e</i>)</li><li><div class="fn" />QButtonGroup <b><a href="qabstractbutton.html#group">group</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qabstractbutton.html#hitButton">hitButton</a></b> (<i>self</i>, QPoint <i>pos</i>)</li><li><div class="fn" />QIcon <b><a href="qabstractbutton.html#icon">icon</a></b> (<i>self</i>)</li><li><div class="fn" />QSize <b><a href="qabstractbutton.html#iconSize">iconSize</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qabstractbutton.html#isCheckable">isCheckable</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qabstractbutton.html#isChecked">isChecked</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qabstractbutton.html#isDown">isDown</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractbutton.html#keyPressEvent">keyPressEvent</a></b> (<i>self</i>, QKeyEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qabstractbutton.html#keyReleaseEvent">keyReleaseEvent</a></b> (<i>self</i>, QKeyEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qabstractbutton.html#mouseMoveEvent">mouseMoveEvent</a></b> (<i>self</i>, QMouseEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qabstractbutton.html#mousePressEvent">mousePressEvent</a></b> (<i>self</i>, QMouseEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qabstractbutton.html#mouseReleaseEvent">mouseReleaseEvent</a></b> (<i>self</i>, QMouseEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qabstractbutton.html#nextCheckState">nextCheckState</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractbutton.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qabstractbutton.html#setAutoExclusive">setAutoExclusive</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qabstractbutton.html#setAutoRepeat">setAutoRepeat</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qabstractbutton.html#setAutoRepeatDelay">setAutoRepeatDelay</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qabstractbutton.html#setAutoRepeatInterval">setAutoRepeatInterval</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qabstractbutton.html#setCheckable">setCheckable</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qabstractbutton.html#setChecked">setChecked</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qabstractbutton.html#setDown">setDown</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qabstractbutton.html#setIcon">setIcon</a></b> (<i>self</i>, QIcon <i>icon</i>)</li><li><div class="fn" /><b><a href="qabstractbutton.html#setIconSize">setIconSize</a></b> (<i>self</i>, QSize <i>size</i>)</li><li><div class="fn" /><b><a href="qabstractbutton.html#setShortcut">setShortcut</a></b> (<i>self</i>, QKeySequence <i>key</i>)</li><li><div class="fn" /><b><a href="qabstractbutton.html#setText">setText</a></b> (<i>self</i>, QString <i>text</i>)</li><li><div class="fn" />QKeySequence <b><a href="qabstractbutton.html#shortcut">shortcut</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qabstractbutton.html#text">text</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractbutton.html#timerEvent">timerEvent</a></b> (<i>self</i>, QTimerEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qabstractbutton.html#toggle">toggle</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qabstractbutton.html#clicked">clicked</a></b> (bool = 0)</li><li><div class="fn" />void <b><a href="qabstractbutton.html#pressed">pressed</a></b> ()</li><li><div class="fn" />void <b><a href="qabstractbutton.html#released">released</a></b> ()</li><li><div class="fn" />void <b><a href="qabstractbutton.html#toggled">toggled</a></b> (bool)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QAbstractButton class is the abstract base class of button widgets, providing functionality common to buttons.</p> <p>This class implements an <i>abstract</i> button. Subclasses of this class handle user actions, and specify how the button is drawn.</p> <p>QAbstractButton provides support for both push buttons and checkable (toggle) buttons. Checkable buttons are implemented in the <a href="qradiobutton.html">QRadioButton</a> and <a href="qcheckbox.html">QCheckBox</a> classes. Push buttons are implemented in the <a href="qpushbutton.html">QPushButton</a> and <a href="qtoolbutton.html">QToolButton</a> classes; these also provide toggle behavior if required.</p> <p>Any button can display a label containing text and an icon. <a href="qabstractbutton.html#text-prop">setText</a>() sets the text; <a href="qabstractbutton.html#icon-prop">setIcon</a>() sets the icon. If a button is disabled, its label is changed to give the button a "disabled" appearance.</p> <p>If the button is a text button with a string containing an ampersand ('&'), QAbstractButton automatically creates a shortcut key. For example:</p> <pre class="cpp"> <span class="type"><a href="qpushbutton.html">QPushButton</a></span> <span class="operator">*</span>button <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qpushbutton.html">QPushButton</a></span>(tr(<span class="string">"Ro&ck && Roll"</span>)<span class="operator">,</span> <span class="keyword">this</span>); </pre> <p>The <b>Alt+C</b> shortcut is assigned to the button, i.e., when the user presses <b>Alt+C</b> the button will call <a href="qabstractbutton.html#animateClick">animateClick</a>(). See the <a href="qshortcut.html#mnemonic">QShortcut</a> documentation for details (to display an actual ampersand, use '&&').</p> <p>You can also set a custom shortcut key using the <a href="qabstractbutton.html#shortcut-prop">setShortcut</a>() function. This is useful mostly for buttons that do not have any text, because they have no automatic shortcut.</p> <pre class="cpp"> button<span class="operator">-</span><span class="operator">></span><a href="qabstractbutton.html#icon-prop">setIcon</a>(<span class="type"><a href="qicon.html">QIcon</a></span>(<span class="string">":/images/print.png"</span>)); button<span class="operator">-</span><span class="operator">></span><a href="qabstractbutton.html#shortcut-prop">setShortcut</a>(tr(<span class="string">"Alt+F7"</span>)); </pre> <p>All of the buttons provided by Qt (<a href="qpushbutton.html">QPushButton</a>, <a href="qtoolbutton.html">QToolButton</a>, <a href="qcheckbox.html">QCheckBox</a>, and <a href="qradiobutton.html">QRadioButton</a>) can display both <a href="qabstractbutton.html#text-prop">text</a> and <a href="qabstractbutton.html#icon-prop">icons</a>.</p> <p>A button can be made the default button in a dialog are provided by <a href="qpushbutton.html#default-prop">QPushButton.setDefault</a>() and <a href="qpushbutton.html#autoDefault-prop">QPushButton.setAutoDefault</a>().</p> <p>QAbstractButton provides most of the states used for buttons:</p> <ul> <li><a href="qabstractbutton.html#down-prop">isDown</a>() indicates whether the button is <i>pressed</i> down.</li> <li><a href="qabstractbutton.html#checked-prop">isChecked</a>() indicates whether the button is <i>checked</i>. Only checkable buttons can be checked and unchecked (see below).</li> <li><a href="qwidget.html#enabled-prop">isEnabled</a>() indicates whether the button can be pressed by the user. <b>Note:</b> As opposed to other widgets, buttons derived from QAbstractButton accepts mouse and context menu events when disabled.</li> <li><a href="qabstractbutton.html#autoRepeat-prop">setAutoRepeat</a>() sets whether the button will auto-repeat if the user holds it down. <a href="qabstractbutton.html#autoRepeatDelay-prop">autoRepeatDelay</a> and <a href="qabstractbutton.html#autoRepeatInterval-prop">autoRepeatInterval</a> define how auto-repetition is done.</li> <li><a href="qabstractbutton.html#checkable-prop">setCheckable</a>() sets whether the button is a toggle button or not.</li> </ul> <p>The difference between <a href="qabstractbutton.html#down-prop">isDown</a>() and <a href="qabstractbutton.html#checked-prop">isChecked</a>() is as follows. When the user clicks a toggle button to check it, the button is first <i>pressed</i> then released into the <i>checked</i> state. When the user clicks it again (to uncheck it), the button moves first to the <i>pressed</i> state, then to the <i>unchecked</i> state (<a href="qabstractbutton.html#checked-prop">isChecked</a>() and <a href="qabstractbutton.html#down-prop">isDown</a>() are both false).</p> <p>QAbstractButton provides four signals:</p> <ol class="1"> <li><a href="qabstractbutton.html#pressed">pressed</a>() is emitted when the left mouse button is pressed while the mouse cursor is inside the button.</li> <li><a href="qabstractbutton.html#released">released</a>() is emitted when the left mouse button is released.</li> <li><a href="qabstractbutton.html#clicked">clicked</a>() is emitted when the button is first pressed and then released, when the shortcut key is typed, or when <a href="qabstractbutton.html#click">click</a>() or <a href="qabstractbutton.html#animateClick">animateClick</a>() is called.</li> <li><a href="qabstractbutton.html#toggled">toggled</a>() is emitted when the state of a toggle button changes.</li> </ol> <p>To subclass QAbstractButton, you must reimplement at least <a href="qabstractbutton.html#paintEvent">paintEvent</a>() to draw the button's outline and its text or pixmap. It is generally advisable to reimplement <a href="qwidget.html#sizeHint-prop">sizeHint</a>() as well, and sometimes <a href="qabstractbutton.html#hitButton">hitButton</a>() (to determine whether a button press is within the button). For buttons with more than two states (like tri-state buttons), you will also have to reimplement <a href="qabstractbutton.html#checkStateSet">checkStateSet</a>() and <a href="qabstractbutton.html#nextCheckState">nextCheckState</a>().</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QAbstractButton" />QAbstractButton.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs an abstract button with a <i>parent</i>.</p> <h3 class="fn"><a name="animateClick" />QAbstractButton.animateClick (<i>self</i>, int <i>msecs</i> = 100)</h3><p>This method is also a Qt slot with the C++ signature <tt>void animateClick(int = 100)</tt>.</p><p>Performs an animated click: the button is pressed immediately, and released <i>msec</i> milliseconds later (the default is 100 ms).</p> <p>Calling this function again before the button was released will reset the release timer.</p> <p>All signals associated with a click are emitted as appropriate.</p> <p>This function does nothing if the button is <a href="qwidget.html#enabled-prop">disabled.</a></p> <p><b>See also</b> <a href="qabstractbutton.html#click">click</a>().</p> <h3 class="fn"><a name="autoExclusive" />bool QAbstractButton.autoExclusive (<i>self</i>)</h3><h3 class="fn"><a name="autoRepeat" />bool QAbstractButton.autoRepeat (<i>self</i>)</h3><h3 class="fn"><a name="autoRepeatDelay" />int QAbstractButton.autoRepeatDelay (<i>self</i>)</h3><h3 class="fn"><a name="autoRepeatInterval" />int QAbstractButton.autoRepeatInterval (<i>self</i>)</h3><h3 class="fn"><a name="changeEvent" />QAbstractButton.changeEvent (<i>self</i>, <a href="qevent.html">QEvent</a> <i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#changeEvent">QWidget.changeEvent</a>().</p> <h3 class="fn"><a name="checkStateSet" />QAbstractButton.checkStateSet (<i>self</i>)</h3><p>This virtual handler is called when <a href="qabstractbutton.html#checked-prop">setChecked</a>() was called, unless it was called from within <a href="qabstractbutton.html#nextCheckState">nextCheckState</a>(). It allows subclasses to reset their intermediate button states.</p> <p><b>See also</b> <a href="qabstractbutton.html#nextCheckState">nextCheckState</a>().</p> <h3 class="fn"><a name="click" />QAbstractButton.click (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void click()</tt>.</p><p>Performs a click.</p> <p>All the usual signals associated with a click are emitted as appropriate. If the button is checkable, the state of the button is toggled.</p> <p>This function does nothing if the button is <a href="qwidget.html#enabled-prop">disabled.</a></p> <p><b>See also</b> <a href="qabstractbutton.html#animateClick">animateClick</a>().</p> <h3 class="fn"><a name="event" />bool QAbstractButton.event (<i>self</i>, <a href="qevent.html">QEvent</a> <i>e</i>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p> <h3 class="fn"><a name="focusInEvent" />QAbstractButton.focusInEvent (<i>self</i>, <a href="qfocusevent.html">QFocusEvent</a> <i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#focusInEvent">QWidget.focusInEvent</a>().</p> <h3 class="fn"><a name="focusOutEvent" />QAbstractButton.focusOutEvent (<i>self</i>, <a href="qfocusevent.html">QFocusEvent</a> <i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#focusOutEvent">QWidget.focusOutEvent</a>().</p> <h3 class="fn"><a name="group" /><a href="qbuttongroup.html">QButtonGroup</a> QAbstractButton.group (<i>self</i>)</h3><p>Returns the group that this button belongs to.</p> <p>If the button is not a member of any <a href="qbuttongroup.html">QButtonGroup</a>, this function returns 0.</p> <p><b>See also</b> <a href="qbuttongroup.html">QButtonGroup</a>.</p> <h3 class="fn"><a name="hitButton" />bool QAbstractButton.hitButton (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>pos</i>)</h3><p>Returns true if <i>pos</i> is inside the clickable button rectangle; otherwise returns false.</p> <p>By default, the clickable area is the entire widget. Subclasses may reimplement this function to provide support for clickable areas of different shapes and sizes.</p> <h3 class="fn"><a name="icon" /><a href="qicon.html">QIcon</a> QAbstractButton.icon (<i>self</i>)</h3><h3 class="fn"><a name="iconSize" /><a href="qsize.html">QSize</a> QAbstractButton.iconSize (<i>self</i>)</h3><h3 class="fn"><a name="isCheckable" />bool QAbstractButton.isCheckable (<i>self</i>)</h3><h3 class="fn"><a name="isChecked" />bool QAbstractButton.isChecked (<i>self</i>)</h3><h3 class="fn"><a name="isDown" />bool QAbstractButton.isDown (<i>self</i>)</h3><h3 class="fn"><a name="keyPressEvent" />QAbstractButton.keyPressEvent (<i>self</i>, <a href="qkeyevent.html">QKeyEvent</a> <i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#keyPressEvent">QWidget.keyPressEvent</a>().</p> <h3 class="fn"><a name="keyReleaseEvent" />QAbstractButton.keyReleaseEvent (<i>self</i>, <a href="qkeyevent.html">QKeyEvent</a> <i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#keyReleaseEvent">QWidget.keyReleaseEvent</a>().</p> <h3 class="fn"><a name="mouseMoveEvent" />QAbstractButton.mouseMoveEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a> <i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#mouseMoveEvent">QWidget.mouseMoveEvent</a>().</p> <h3 class="fn"><a name="mousePressEvent" />QAbstractButton.mousePressEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a> <i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#mousePressEvent">QWidget.mousePressEvent</a>().</p> <h3 class="fn"><a name="mouseReleaseEvent" />QAbstractButton.mouseReleaseEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a> <i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#mouseReleaseEvent">QWidget.mouseReleaseEvent</a>().</p> <h3 class="fn"><a name="nextCheckState" />QAbstractButton.nextCheckState (<i>self</i>)</h3><p>This virtual handler is called when a button is clicked. The default implementation calls setChecked(!<a href="qabstractbutton.html#checked-prop">isChecked</a>()) if the button <a href="qabstractbutton.html#checkable-prop">isCheckable</a>(). It allows subclasses to implement intermediate button states.</p> <p><b>See also</b> <a href="qabstractbutton.html#checkStateSet">checkStateSet</a>().</p> <h3 class="fn"><a name="paintEvent" />QAbstractButton.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a> <i>e</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>().</p> <h3 class="fn"><a name="setAutoExclusive" />QAbstractButton.setAutoExclusive (<i>self</i>, bool)</h3><h3 class="fn"><a name="setAutoRepeat" />QAbstractButton.setAutoRepeat (<i>self</i>, bool)</h3><h3 class="fn"><a name="setAutoRepeatDelay" />QAbstractButton.setAutoRepeatDelay (<i>self</i>, int)</h3><h3 class="fn"><a name="setAutoRepeatInterval" />QAbstractButton.setAutoRepeatInterval (<i>self</i>, int)</h3><h3 class="fn"><a name="setCheckable" />QAbstractButton.setCheckable (<i>self</i>, bool)</h3><h3 class="fn"><a name="setChecked" />QAbstractButton.setChecked (<i>self</i>, bool)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setChecked(bool)</tt>.</p><h3 class="fn"><a name="setDown" />QAbstractButton.setDown (<i>self</i>, bool)</h3><h3 class="fn"><a name="setIcon" />QAbstractButton.setIcon (<i>self</i>, <a href="qicon.html">QIcon</a> <i>icon</i>)</h3><h3 class="fn"><a name="setIconSize" />QAbstractButton.setIconSize (<i>self</i>, <a href="qsize.html">QSize</a> <i>size</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setIconSize(const QSize&)</tt>.</p><h3 class="fn"><a name="setShortcut" />QAbstractButton.setShortcut (<i>self</i>, <a href="qkeysequence.html">QKeySequence</a> <i>key</i>)</h3><h3 class="fn"><a name="setText" />QAbstractButton.setText (<i>self</i>, QString <i>text</i>)</h3><h3 class="fn"><a name="shortcut" /><a href="qkeysequence.html">QKeySequence</a> QAbstractButton.shortcut (<i>self</i>)</h3><h3 class="fn"><a name="text" />QString QAbstractButton.text (<i>self</i>)</h3><h3 class="fn"><a name="timerEvent" />QAbstractButton.timerEvent (<i>self</i>, <a href="qtimerevent.html">QTimerEvent</a> <i>e</i>)</h3><p>Reimplemented from <a href="qobject.html#timerEvent">QObject.timerEvent</a>().</p> <h3 class="fn"><a name="toggle" />QAbstractButton.toggle (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void toggle()</tt>.</p><p>Toggles the state of a checkable button.</p> <p><b>See also</b> <a href="qabstractbutton.html#checked-prop">checked</a>.</p> <hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="clicked" />void clicked (bool = 0)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the button is activated (i.e. pressed down then released while the mouse cursor is inside the button), when the shortcut key is typed, or when <a href="qabstractbutton.html#click">click</a>() or <a href="qabstractbutton.html#animateClick">animateClick</a>() is called. Notably, this signal is <i>not</i> emitted if you call <a href="qabstractbutton.html#down-prop">setDown</a>(), <a href="qabstractbutton.html#checked-prop">setChecked</a>() or <a href="qabstractbutton.html#toggle">toggle</a>().</p> <p>If the button is checkable, <i>checked</i> is true if the button is checked, or false if the button is unchecked.</p> <p><b>See also</b> <a href="qabstractbutton.html#pressed">pressed</a>(), <a href="qabstractbutton.html#released">released</a>(), and <a href="qabstractbutton.html#toggled">toggled</a>().</p> <h3 class="fn"><a name="pressed" />void pressed ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the button is pressed down.</p> <p><b>See also</b> <a href="qabstractbutton.html#released">released</a>() and <a href="qabstractbutton.html#clicked">clicked</a>().</p> <h3 class="fn"><a name="released" />void released ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the button is released.</p> <p><b>See also</b> <a href="qabstractbutton.html#pressed">pressed</a>(), <a href="qabstractbutton.html#clicked">clicked</a>(), and <a href="qabstractbutton.html#toggled">toggled</a>().</p> <h3 class="fn"><a name="toggled" />void toggled (bool)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever a checkable button changes its state. <i>checked</i> is true if the button is checked, or false if the button is unchecked.</p> <p>This may be the result of a user action, <a href="qabstractbutton.html#click">click</a>() slot activation, or because <a href="qabstractbutton.html#checked-prop">setChecked</a>() was called.</p> <p>The states of buttons in exclusive button groups are updated before this signal is emitted. This means that slots can act on either the "off" signal or the "on" signal emitted by the buttons in the group whose states have changed.</p> <p>For example, a slot that reacts to signals emitted by newly checked buttons but which ignores signals from buttons that have been unchecked can be implemented using the following pattern:</p> <pre class="cpp"> <span class="type">void</span> MyWidget<span class="operator">.</span>reactToToggle(<span class="type">bool</span> checked) { <span class="keyword">if</span> (checked) { <span class="comment">// Examine the new button states.</span> <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span> } } </pre> <p>Button groups can be created using the <a href="qbuttongroup.html">QButtonGroup</a> class, and updates to the button states monitored with the <a href="qbuttongroup.html#buttonClicked">QButtonGroup.buttonClicked</a>() signal.</p> <p><b>See also</b> <a href="qabstractbutton.html#checked-prop">checked</a> and <a href="qabstractbutton.html#clicked">clicked</a>().</p> <address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>