Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-updates > by-pkgid > d5e62c01ae8d1e579463c6a871dd44bf > files > 3647

qtbase5-doc-5.12.6-2.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qabstractbutton.cpp -->
  <title>QAbstractButton Class | Qt Widgets 5.12.6</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.12</td><td ><a href="qtwidgets-index.html">Qt Widgets</a></td><td ><a href="qtwidgets-module.html">C++ Classes</a></td><td >QAbstractButton</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtwidgets-index.html">Qt 5.12.6 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#reimplemented-protected-functions">Reimplemented Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QAbstractButton Class</h1>
<!-- $$$QAbstractButton-brief -->
<p>The <a href="qabstractbutton.html">QAbstractButton</a> class is the abstract base class of button widgets, providing functionality common to buttons. <a href="#details">More...</a></p>
<!-- @@@QAbstractButton -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QAbstractButton&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += widgets</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qwidget.html">QWidget</a></td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherited By:</td><td class="memItemRight bottomAlign"> <p><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>
</td></tr></table></div><ul>
<li><a href="qabstractbutton-members.html">List of all members, including inherited members</a></li>
<li><a href="qabstractbutton-obsolete.html">Obsolete members</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<div class="table"><table class="propsummary">
<tr><td class="topAlign"><ul>
<li class="fn"><b><a href="qabstractbutton.html#autoExclusive-prop">autoExclusive</a></b> : bool</li>
<li class="fn"><b><a href="qabstractbutton.html#autoRepeat-prop">autoRepeat</a></b> : bool</li>
<li class="fn"><b><a href="qabstractbutton.html#autoRepeatDelay-prop">autoRepeatDelay</a></b> : int</li>
<li class="fn"><b><a href="qabstractbutton.html#autoRepeatInterval-prop">autoRepeatInterval</a></b> : int</li>
<li class="fn"><b><a href="qabstractbutton.html#checkable-prop">checkable</a></b> : bool</li>
<li class="fn"><b><a href="qabstractbutton.html#checked-prop">checked</a></b> : bool</li>
</ul></td><td class="topAlign"><ul>
<li class="fn"><b><a href="qabstractbutton.html#down-prop">down</a></b> : bool</li>
<li class="fn"><b><a href="qabstractbutton.html#icon-prop">icon</a></b> : QIcon</li>
<li class="fn"><b><a href="qabstractbutton.html#iconSize-prop">iconSize</a></b> : QSize</li>
<li class="fn"><b><a href="qabstractbutton.html#shortcut-prop">shortcut</a></b> : QKeySequence</li>
<li class="fn"><b><a href="qabstractbutton.html#text-prop">text</a></b> : QString</li>
</ul>
</td></tr>
</table></div>
<ul>
<li class="fn">59 properties inherited from <a href="qwidget.html#properties">QWidget</a></li>
<li class="fn">1 property inherited from <a href="../qtcore/qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#QAbstractButton">QAbstractButton</a></b>(QWidget *<i>parent</i> = nullptr)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#dtor.QAbstractButton">~QAbstractButton</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#autoExclusive-prop">autoExclusive</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#autoRepeat-prop">autoRepeat</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#autoRepeatDelay-prop">autoRepeatDelay</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#autoRepeatInterval-prop">autoRepeatInterval</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QButtonGroup *</td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#group">group</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QIcon </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#icon-prop">icon</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSize </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#iconSize-prop">iconSize</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#checkable-prop">isCheckable</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#checked-prop">isChecked</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#down-prop">isDown</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#autoExclusive-prop">setAutoExclusive</a></b>(<i>bool</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#autoRepeat-prop">setAutoRepeat</a></b>(<i>bool</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#autoRepeatDelay-prop">setAutoRepeatDelay</a></b>(<i>int</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#autoRepeatInterval-prop">setAutoRepeatInterval</a></b>(<i>int</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#checkable-prop">setCheckable</a></b>(<i>bool</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#down-prop">setDown</a></b>(<i>bool</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#icon-prop">setIcon</a></b>(const QIcon &amp;<i>icon</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#shortcut-prop">setShortcut</a></b>(const QKeySequence &amp;<i>key</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#text-prop">setText</a></b>(const QString &amp;<i>text</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QKeySequence </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#shortcut-prop">shortcut</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#text-prop">text</a></b>() const</td></tr>
</table></div>
<ul>
<li class="fn">214 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li>
<li class="fn">31 public functions inherited from <a href="../qtcore/qobject.html#public-functions">QObject</a></li>
<li class="fn">14 public functions inherited from <a href="../qtgui/qpaintdevice.html#public-functions">QPaintDevice</a></li>
</ul>
<a name="public-slots"></a>
<h2 id="public-slots">Public Slots</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#animateClick">animateClick</a></b>(int <i>msec</i> = 100)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#click">click</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#checked-prop">setChecked</a></b>(<i>bool</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#iconSize-prop">setIconSize</a></b>(const QSize &amp;<i>size</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#toggle">toggle</a></b>()</td></tr>
</table></div>
<ul>
<li class="fn">19 public slots inherited from <a href="qwidget.html#public-slots">QWidget</a></li>
<li class="fn">1 public slot inherited from <a href="../qtcore/qobject.html#public-slots">QObject</a></li>
</ul>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#clicked">clicked</a></b>(bool <i>checked</i> = false)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#pressed">pressed</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#released">released</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#toggled">toggled</a></b>(bool <i>checked</i>)</td></tr>
</table></div>
<ul>
<li class="fn">3 signals inherited from <a href="qwidget.html#signals">QWidget</a></li>
<li class="fn">2 signals inherited from <a href="../qtcore/qobject.html#signals">QObject</a></li>
</ul>
<a name="static-public-members"></a>
<h2 id="static-public-members">Static Public Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> const QMetaObject </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#staticMetaObject-var">staticMetaObject</a></b></td></tr>
</table></div>
<ul>
<li class="fn">5 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li>
<li class="fn">9 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">QObject</a></li>
</ul>
<a name="protected-functions"></a>
<h2 id="protected-functions">Protected Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#checkStateSet">checkStateSet</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#hitButton">hitButton</a></b>(const QPoint &amp;<i>pos</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#nextCheckState">nextCheckState</a></b>()</td></tr>
</table></div>
<a name="reimplemented-protected-functions"></a>
<h2 id="reimplemented-protected-functions">Reimplemented Protected Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#changeEvent">changeEvent</a></b>(QEvent *<i>e</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#event">event</a></b>(QEvent *<i>e</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#focusInEvent">focusInEvent</a></b>(QFocusEvent *<i>e</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#focusOutEvent">focusOutEvent</a></b>(QFocusEvent *<i>e</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#keyPressEvent">keyPressEvent</a></b>(QKeyEvent *<i>e</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#keyReleaseEvent">keyReleaseEvent</a></b>(QKeyEvent *<i>e</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#mouseMoveEvent">mouseMoveEvent</a></b>(QMouseEvent *<i>e</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#mousePressEvent">mousePressEvent</a></b>(QMouseEvent *<i>e</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#mouseReleaseEvent">mouseReleaseEvent</a></b>(QMouseEvent *<i>e</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#paintEvent">paintEvent</a></b>(QPaintEvent *<i>e</i>) override = 0</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractbutton.html#timerEvent">timerEvent</a></b>(QTimerEvent *<i>e</i>) override</td></tr>
</table></div>
<ul>
<li class="fn">35 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li>
<li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li>
<li class="fn">1 protected function inherited from <a href="../qtgui/qpaintdevice.html#protected-functions">QPaintDevice</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 protected slot inherited from <a href="qwidget.html#protected-slots">QWidget</a></li>
</ul>
<a name="details"></a>
<!-- $$$QAbstractButton-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qabstractbutton.html">QAbstractButton</a> 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><a href="qabstractbutton.html">QAbstractButton</a> 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 &quot;disabled&quot; appearance.</p>
<p>If the button is a text button with a string containing an ampersand ('&amp;'), <a href="qabstractbutton.html">QAbstractButton</a> 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">&quot;Ro&amp;ck &amp;&amp; Roll&quot;</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&#x2e;, 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 '&amp;&amp;'.</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, and therefore can't have any automatic shortcut.</p>
<pre class="cpp">

  button<span class="operator">-</span><span class="operator">&gt;</span>setIcon(<span class="type"><a href="../qtgui/qicon.html">QIcon</a></span>(<span class="string">&quot;:/images/print.png&quot;</span>));
  button<span class="operator">-</span><span class="operator">&gt;</span>setShortcut(tr(<span class="string">&quot;Alt+F7&quot;</span>));

</pre>
<p>All 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="stylesheet-reference.html#icon">icons</a>.</p>
<p>A button can be made the default button in a dialog by means of <a href="qpushbutton.html#default-prop">QPushButton::setDefault</a>() and <a href="qpushbutton.html#autoDefault-prop">QPushButton::setAutoDefault</a>().</p>
<p><a href="qabstractbutton.html">QAbstractButton</a> 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.<p><b>Note: </b>As opposed to other widgets, buttons derived from <a href="qabstractbutton.html">QAbstractButton</a> accept mouse and context menu events when disabled.</p></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><a href="qabstractbutton.html">QAbstractButton</a> provides four signals:</p>
<ol class="1" type="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 <a href="qabstractbutton.html">QAbstractButton</a>, 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>
</div>
<p><b>See also </b><a href="qbuttongroup.html">QButtonGroup</a>.</p>
<!-- @@@QAbstractButton -->
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$autoExclusive-prop$$$autoExclusive$$$setAutoExclusivebool -->
<h3 class="fn" id="autoExclusive-prop"><a name="autoExclusive-prop"></a><span class="name">autoExclusive</span> : <span class="type">bool</span></h3>
<p>This property holds whether auto-exclusivity is enabled</p>
<p>If auto-exclusivity is enabled, checkable buttons that belong to the same parent widget behave as if they were part of the same exclusive button group. In an exclusive button group, only one button can be checked at any time; checking another button automatically unchecks the previously checked one.</p>
<p>The property has no effect on buttons that belong to a button group.</p>
<p>autoExclusive is off by default, except for radio buttons.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>autoExclusive</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setAutoExclusive</b></span>(<i>bool</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qradiobutton.html">QRadioButton</a>.</p>
<!-- @@@autoExclusive -->
<!-- $$$autoRepeat-prop$$$autoRepeat$$$setAutoRepeatbool -->
<h3 class="fn" id="autoRepeat-prop"><a name="autoRepeat-prop"></a><span class="name">autoRepeat</span> : <span class="type">bool</span></h3>
<p>This property holds whether autoRepeat is enabled</p>
<p>If autoRepeat is enabled, then the <a href="qabstractbutton.html#pressed">pressed</a>(), <a href="qabstractbutton.html#released">released</a>(), and <a href="qabstractbutton.html#clicked">clicked</a>() signals are emitted at regular intervals when the button is down. autoRepeat is off by default. The initial delay and the repetition interval are defined in milliseconds by <a href="qabstractbutton.html#autoRepeatDelay-prop">autoRepeatDelay</a> and <a href="qabstractbutton.html#autoRepeatInterval-prop">autoRepeatInterval</a>.</p>
<p>Note: If a button is pressed down by a shortcut key, then auto-repeat is enabled and timed by the system and not by this class. The <a href="qabstractbutton.html#pressed">pressed</a>(), <a href="qabstractbutton.html#released">released</a>(), and <a href="qabstractbutton.html#clicked">clicked</a>() signals will be emitted like in the normal case.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>autoRepeat</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setAutoRepeat</b></span>(<i>bool</i>)</td></tr>
</table></div>
<!-- @@@autoRepeat -->
<!-- $$$autoRepeatDelay-prop$$$autoRepeatDelay$$$setAutoRepeatDelayint -->
<h3 class="fn" id="autoRepeatDelay-prop"><a name="autoRepeatDelay-prop"></a><span class="name">autoRepeatDelay</span> : <span class="type">int</span></h3>
<p>This property holds the initial delay of auto-repetition</p>
<p>If <a href="qabstractbutton.html#autoRepeat-prop">autoRepeat</a> is enabled, then autoRepeatDelay defines the initial delay in milliseconds before auto-repetition kicks in.</p>
<p>This property was introduced in  Qt 4.2.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>autoRepeatDelay</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setAutoRepeatDelay</b></span>(<i>int</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qabstractbutton.html#autoRepeat-prop">autoRepeat</a> and <a href="qabstractbutton.html#autoRepeatInterval-prop">autoRepeatInterval</a>.</p>
<!-- @@@autoRepeatDelay -->
<!-- $$$autoRepeatInterval-prop$$$autoRepeatInterval$$$setAutoRepeatIntervalint -->
<h3 class="fn" id="autoRepeatInterval-prop"><a name="autoRepeatInterval-prop"></a><span class="name">autoRepeatInterval</span> : <span class="type">int</span></h3>
<p>This property holds the interval of auto-repetition</p>
<p>If <a href="qabstractbutton.html#autoRepeat-prop">autoRepeat</a> is enabled, then autoRepeatInterval defines the length of the auto-repetition interval in millisecons.</p>
<p>This property was introduced in  Qt 4.2.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>autoRepeatInterval</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setAutoRepeatInterval</b></span>(<i>int</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qabstractbutton.html#autoRepeat-prop">autoRepeat</a> and <a href="qabstractbutton.html#autoRepeatDelay-prop">autoRepeatDelay</a>.</p>
<!-- @@@autoRepeatInterval -->
<!-- $$$checkable-prop$$$isCheckable$$$setCheckablebool -->
<h3 class="fn" id="checkable-prop"><a name="checkable-prop"></a><span class="name">checkable</span> : <span class="type">bool</span></h3>
<p>This property holds whether the button is checkable</p>
<p>By default, the button is not checkable.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isCheckable</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setCheckable</b></span>(<i>bool</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qabstractbutton.html#checked-prop">checked</a>.</p>
<!-- @@@checkable -->
<!-- $$$checked-prop$$$isChecked$$$setCheckedbool$$$toggledbool -->
<h3 class="fn" id="checked-prop"><a name="checked-prop"></a><span class="name">checked</span> : <span class="type">bool</span></h3>
<p>This property holds whether the button is checked</p>
<p>Only checkable buttons can be checked. By default, the button is unchecked.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isChecked</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setChecked</b></span>(<i>bool</i>)</td></tr>
</table></div>
<p><b>Notifier signal:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="qabstractbutton.html#toggled">toggled</a></b></span>(bool <i>checked</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qabstractbutton.html#checkable-prop">checkable</a>.</p>
<!-- @@@checked -->
<!-- $$$down-prop$$$isDown$$$setDownbool -->
<h3 class="fn" id="down-prop"><a name="down-prop"></a><span class="name">down</span> : <span class="type">bool</span></h3>
<p>This property holds whether the button is pressed down</p>
<p>If this property is <code>true</code>, the button is pressed down. The signals <a href="qabstractbutton.html#pressed">pressed</a>() and <a href="qabstractbutton.html#clicked">clicked</a>() are not emitted if you set this property to true. The default is false.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isDown</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setDown</b></span>(<i>bool</i>)</td></tr>
</table></div>
<!-- @@@down -->
<!-- $$$icon-prop$$$icon$$$setIconconstQIcon& -->
<h3 class="fn" id="icon-prop"><a name="icon-prop"></a><span class="name">icon</span> : <span class="type"><a href="../qtgui/qicon.html">QIcon</a></span></h3>
<p>This property holds the icon shown on the button</p>
<p>The icon's default size is defined by the GUI style, but can be adjusted by setting the <a href="qabstractbutton.html#iconSize-prop">iconSize</a> property.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QIcon </td><td class="memItemRight bottomAlign"><span class="name"><b>icon</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setIcon</b></span>(const QIcon &amp;<i>icon</i>)</td></tr>
</table></div>
<!-- @@@icon -->
<!-- $$$iconSize-prop$$$iconSize$$$setIconSizeconstQSize& -->
<h3 class="fn" id="iconSize-prop"><a name="iconSize-prop"></a><span class="name">iconSize</span> : <span class="type"><a href="../qtcore/qsize.html">QSize</a></span></h3>
<p>This property holds the icon size used for this button.</p>
<p>The default size is defined by the GUI style. This is a maximum size for the icons. Smaller icons will not be scaled up.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QSize </td><td class="memItemRight bottomAlign"><span class="name"><b>iconSize</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setIconSize</b></span>(const QSize &amp;<i>size</i>)</td></tr>
</table></div>
<!-- @@@iconSize -->
<!-- $$$shortcut-prop$$$shortcut$$$setShortcutconstQKeySequence& -->
<h3 class="fn" id="shortcut-prop"><a name="shortcut-prop"></a><span class="name">shortcut</span> : <span class="type"><a href="../qtgui/qkeysequence.html">QKeySequence</a></span></h3>
<p>This property holds the mnemonic associated with the button</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QKeySequence </td><td class="memItemRight bottomAlign"><span class="name"><b>shortcut</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setShortcut</b></span>(const QKeySequence &amp;<i>key</i>)</td></tr>
</table></div>
<!-- @@@shortcut -->
<!-- $$$text-prop$$$text$$$setTextconstQString& -->
<h3 class="fn" id="text-prop"><a name="text-prop"></a><span class="name">text</span> : <span class="type"><a href="../qtcore/qstring.html">QString</a></span></h3>
<p>This property holds the text shown on the button</p>
<p>If the button has no text, the text() function will return an empty string.</p>
<p>If the text contains an ampersand character ('&amp;'), a shortcut is automatically created for it. The character that follows the '&amp;' will be used as the shortcut key. Any previous shortcut will be overwritten or cleared if no shortcut is defined by the text. See the <a href="qshortcut.html#mnemonic">QShortcut</a> documentation for details. To display an actual ampersand, use '&amp;&amp;'.</p>
<p>There is no default text.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QString </td><td class="memItemRight bottomAlign"><span class="name"><b>text</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setText</b></span>(const QString &amp;<i>text</i>)</td></tr>
</table></div>
<!-- @@@text -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QAbstractButton[overload1]$$$QAbstractButtonQWidget* -->
<h3 class="fn" id="QAbstractButton"><a name="QAbstractButton"></a>QAbstractButton::<span class="name">QAbstractButton</span>(<span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>parent</i> = nullptr)</h3>
<p>Constructs an abstract button with a <i>parent</i>.</p>
<!-- @@@QAbstractButton -->
<!-- $$$~QAbstractButton[overload1]$$$~QAbstractButton -->
<h3 class="fn" id="dtor.QAbstractButton"><a name="dtor.QAbstractButton"></a><code>[virtual] </code>QAbstractButton::<span class="name">~QAbstractButton</span>()</h3>
<p>Destroys the button.</p>
<!-- @@@~QAbstractButton -->
<!-- $$$animateClick[overload1]$$$animateClickint -->
<h3 class="fn" id="animateClick"><a name="animateClick"></a><code>[slot] </code><span class="type">void</span> QAbstractButton::<span class="name">animateClick</span>(<span class="type">int</span> <i>msec</i> = 100)</h3>
<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 is released resets 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>
<!-- @@@animateClick -->
<!-- $$$changeEvent[overload1]$$$changeEventQEvent* -->
<h3 class="fn" id="changeEvent"><a name="changeEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QAbstractButton::<span class="name">changeEvent</span>(<span class="type"><a href="../qtcore/qevent.html">QEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#changeEvent">QWidget::changeEvent</a>().</p>
<!-- @@@changeEvent -->
<!-- $$$checkStateSet[overload1]$$$checkStateSet -->
<h3 class="fn" id="checkStateSet"><a name="checkStateSet"></a><code>[virtual protected] </code><span class="type">void</span> QAbstractButton::<span class="name">checkStateSet</span>()</h3>
<p>This virtual handler is called when <a href="qabstractbutton.html#checked-prop">setChecked</a>() is used, unless it is 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>
<!-- @@@checkStateSet -->
<!-- $$$click[overload1]$$$click -->
<h3 class="fn" id="click"><a name="click"></a><code>[slot] </code><span class="type">void</span> QAbstractButton::<span class="name">click</span>()</h3>
<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>
<!-- @@@click -->
<!-- $$$clicked[overload1]$$$clickedbool -->
<h3 class="fn" id="clicked"><a name="clicked"></a><code>[signal] </code><span class="type">void</span> QAbstractButton::<span class="name">clicked</span>(<span class="type">bool</span> <i>checked</i> = false)</h3>
<p>This signal is emitted when the button is activated (i.e&#x2e;, 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>
<!-- @@@clicked -->
<!-- $$$event[overload1]$$$eventQEvent* -->
<h3 class="fn" id="event"><a name="event"></a><code>[override virtual protected] </code><span class="type">bool</span> QAbstractButton::<span class="name">event</span>(<span class="type"><a href="../qtcore/qevent.html">QEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#event">QWidget::event</a>().</p>
<!-- @@@event -->
<!-- $$$focusInEvent[overload1]$$$focusInEventQFocusEvent* -->
<h3 class="fn" id="focusInEvent"><a name="focusInEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QAbstractButton::<span class="name">focusInEvent</span>(<span class="type"><a href="../qtgui/qfocusevent.html">QFocusEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#focusInEvent">QWidget::focusInEvent</a>().</p>
<!-- @@@focusInEvent -->
<!-- $$$focusOutEvent[overload1]$$$focusOutEventQFocusEvent* -->
<h3 class="fn" id="focusOutEvent"><a name="focusOutEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QAbstractButton::<span class="name">focusOutEvent</span>(<span class="type"><a href="../qtgui/qfocusevent.html">QFocusEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#focusOutEvent">QWidget::focusOutEvent</a>().</p>
<!-- @@@focusOutEvent -->
<!-- $$$group[overload1]$$$group -->
<h3 class="fn" id="group"><a name="group"></a><span class="type"><a href="qbuttongroup.html">QButtonGroup</a></span> *QAbstractButton::<span class="name">group</span>() const</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 <code>nullptr</code>.</p>
<p><b>See also </b><a href="qbuttongroup.html">QButtonGroup</a>.</p>
<!-- @@@group -->
<!-- $$$hitButton[overload1]$$$hitButtonconstQPoint& -->
<h3 class="fn" id="hitButton"><a name="hitButton"></a><code>[virtual protected] </code><span class="type">bool</span> QAbstractButton::<span class="name">hitButton</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>pos</i>) const</h3>
<p>Returns <code>true</code> if <i>pos</i> is inside the clickable button rectangle; otherwise returns <code>false</code>.</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>
<!-- @@@hitButton -->
<!-- $$$keyPressEvent[overload1]$$$keyPressEventQKeyEvent* -->
<h3 class="fn" id="keyPressEvent"><a name="keyPressEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QAbstractButton::<span class="name">keyPressEvent</span>(<span class="type"><a href="../qtgui/qkeyevent.html">QKeyEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#keyPressEvent">QWidget::keyPressEvent</a>().</p>
<!-- @@@keyPressEvent -->
<!-- $$$keyReleaseEvent[overload1]$$$keyReleaseEventQKeyEvent* -->
<h3 class="fn" id="keyReleaseEvent"><a name="keyReleaseEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QAbstractButton::<span class="name">keyReleaseEvent</span>(<span class="type"><a href="../qtgui/qkeyevent.html">QKeyEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#keyReleaseEvent">QWidget::keyReleaseEvent</a>().</p>
<!-- @@@keyReleaseEvent -->
<!-- $$$mouseMoveEvent[overload1]$$$mouseMoveEventQMouseEvent* -->
<h3 class="fn" id="mouseMoveEvent"><a name="mouseMoveEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QAbstractButton::<span class="name">mouseMoveEvent</span>(<span class="type"><a href="../qtgui/qmouseevent.html">QMouseEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#mouseMoveEvent">QWidget::mouseMoveEvent</a>().</p>
<!-- @@@mouseMoveEvent -->
<!-- $$$mousePressEvent[overload1]$$$mousePressEventQMouseEvent* -->
<h3 class="fn" id="mousePressEvent"><a name="mousePressEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QAbstractButton::<span class="name">mousePressEvent</span>(<span class="type"><a href="../qtgui/qmouseevent.html">QMouseEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#mousePressEvent">QWidget::mousePressEvent</a>().</p>
<!-- @@@mousePressEvent -->
<!-- $$$mouseReleaseEvent[overload1]$$$mouseReleaseEventQMouseEvent* -->
<h3 class="fn" id="mouseReleaseEvent"><a name="mouseReleaseEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QAbstractButton::<span class="name">mouseReleaseEvent</span>(<span class="type"><a href="../qtgui/qmouseevent.html">QMouseEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#mouseReleaseEvent">QWidget::mouseReleaseEvent</a>().</p>
<!-- @@@mouseReleaseEvent -->
<!-- $$$nextCheckState[overload1]$$$nextCheckState -->
<h3 class="fn" id="nextCheckState"><a name="nextCheckState"></a><code>[virtual protected] </code><span class="type">void</span> QAbstractButton::<span class="name">nextCheckState</span>()</h3>
<p>This virtual handler is called when a button is clicked. The default implementation calls <a href="qabstractbutton.html#checked-prop">setChecked</a>(!<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>
<!-- @@@nextCheckState -->
<!-- $$$paintEvent[overload1]$$$paintEventQPaintEvent* -->
<h3 class="fn" id="paintEvent"><a name="paintEvent"></a><code>[override pure virtual protected] </code><span class="type">void</span> QAbstractButton::<span class="name">paintEvent</span>(<span class="type"><a href="../qtgui/qpaintevent.html">QPaintEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget::paintEvent</a>().</p>
<!-- @@@paintEvent -->
<!-- $$$pressed[overload1]$$$pressed -->
<h3 class="fn" id="pressed"><a name="pressed"></a><code>[signal] </code><span class="type">void</span> QAbstractButton::<span class="name">pressed</span>()</h3>
<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>
<!-- @@@pressed -->
<!-- $$$released[overload1]$$$released -->
<h3 class="fn" id="released"><a name="released"></a><code>[signal] </code><span class="type">void</span> QAbstractButton::<span class="name">released</span>()</h3>
<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>
<!-- @@@released -->
<!-- $$$timerEvent[overload1]$$$timerEventQTimerEvent* -->
<h3 class="fn" id="timerEvent"><a name="timerEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QAbstractButton::<span class="name">timerEvent</span>(<span class="type"><a href="../qtcore/qtimerevent.html">QTimerEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="../qtcore/qobject.html#timerEvent">QObject::timerEvent</a>().</p>
<!-- @@@timerEvent -->
<!-- $$$toggle[overload1]$$$toggle -->
<h3 class="fn" id="toggle"><a name="toggle"></a><code>[slot] </code><span class="type">void</span> QAbstractButton::<span class="name">toggle</span>()</h3>
<p>Toggles the state of a checkable button.</p>
<p><b>See also </b><a href="qabstractbutton.html#checked-prop">checked</a>.</p>
<!-- @@@toggle -->
<!-- $$$toggled -->
<h3 class="fn" id="toggled"><a name="toggled"></a><code>[signal] </code><span class="type">void</span> QAbstractButton::<span class="name">toggled</span>(<span class="type">bool</span> <i>checked</i>)</h3>
<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>() is 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 &quot;off&quot; signal or the &quot;on&quot; 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(bool 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>Note:</b> Notifier signal for property <a href="qabstractbutton.html#checked-prop">checked</a>. </p><p><b>See also </b><a href="qabstractbutton.html#checked-prop">checked</a> and <a href="qabstractbutton.html#clicked">clicked</a>().</p>
<!-- @@@toggled -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>