1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
<?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>QButtonGroup 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">QButtonGroup Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QButtonGroup class provides a container to organize groups
of button widgets. <a href="#details">More...</a></p>
<p>Inherits <a href="qobject.html">QObject</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qbuttongroup.html#QButtonGroup">__init__</a></b> (<i>self</i>, QObject <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qbuttongroup.html#addButton">addButton</a></b> (<i>self</i>, QAbstractButton)</li><li><div class="fn" /><b><a href="qbuttongroup.html#addButton-2">addButton</a></b> (<i>self</i>, QAbstractButton, int <i>id</i>)</li><li><div class="fn" />QAbstractButton <b><a href="qbuttongroup.html#button">button</a></b> (<i>self</i>, int <i>id</i>)</li><li><div class="fn" />unknown-type <b><a href="qbuttongroup.html#buttons">buttons</a></b> (<i>self</i>)</li><li><div class="fn" />QAbstractButton <b><a href="qbuttongroup.html#checkedButton">checkedButton</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qbuttongroup.html#checkedId">checkedId</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qbuttongroup.html#exclusive">exclusive</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qbuttongroup.html#id">id</a></b> (<i>self</i>, QAbstractButton <i>button</i>)</li><li><div class="fn" /><b><a href="qbuttongroup.html#removeButton">removeButton</a></b> (<i>self</i>, QAbstractButton)</li><li><div class="fn" /><b><a href="qbuttongroup.html#setExclusive">setExclusive</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qbuttongroup.html#setId">setId</a></b> (<i>self</i>, QAbstractButton <i>button</i>, int <i>id</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qbuttongroup.html#buttonClicked">buttonClicked</a></b> ( ::QAbstractButton*)</li><li><div class="fn" />void <b><a href="qbuttongroup.html#buttonClicked-2">buttonClicked</a></b> (int)</li><li><div class="fn" />void <b><a href="qbuttongroup.html#buttonPressed">buttonPressed</a></b> ( ::QAbstractButton*)</li><li><div class="fn" />void <b><a href="qbuttongroup.html#buttonPressed-2">buttonPressed</a></b> (int)</li><li><div class="fn" />void <b><a href="qbuttongroup.html#buttonReleased">buttonReleased</a></b> ( ::QAbstractButton*)</li><li><div class="fn" />void <b><a href="qbuttongroup.html#buttonReleased-2">buttonReleased</a></b> (int)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QButtonGroup class provides a container to organize groups
of button widgets.</p>
<p>QButtonGroup provides an abstract container into which button
widgets can be placed. It does not provide a visual representation
of this container (see <a href="qgroupbox.html">QGroupBox</a> for a
container widget), but instead manages the states of each of the
buttons in the group.</p>
<p>An <a href="qbuttongroup.html#exclusive-prop">exclusive</a>
button group switches off all checkable (toggle) buttons except the
one that was clicked. By default, a button group is exclusive. The
buttons in a button group are usually checkable <a href="qpushbutton.html">QPushButton</a>'s, <a href="qcheckbox.html">QCheckBox</a>es (normally for non-exclusive button
groups), or <a href="qradiobutton.html">QRadioButton</a>s. If you
create an exclusive button group, you should ensure that one of the
buttons in the group is initially checked; otherwise, the group
will initially be in a state where no buttons are checked.</p>
<p>A button is added to the group with <a href="qbuttongroup.html#addButton">addButton</a>(). It can be removed
from the group with <a href="qbuttongroup.html#removeButton">removeButton</a>(). If the group
is exclusive, the currently checked button is available as <a href="qbuttongroup.html#checkedButton">checkedButton</a>(). If a button
is clicked the <a href="qbuttongroup.html#buttonClicked">buttonClicked</a>() signal is
emitted. For a checkable button in an exclusive group this means
that the button was checked. The list of buttons in the group is
returned by <a href="qbuttongroup.html#buttons">buttons</a>().</p>
<p>In addition, QButtonGroup can map between integers and buttons.
You can assign an integer id to a button with <a href="qbuttongroup.html#setId">setId</a>(), and retrieve it with
<a href="qbuttongroup.html#id">id</a>(). The id of the currently
checked button is available with <a href="qbuttongroup.html#checkedId">checkedId</a>(), and there is an
overloaded signal <a href="qbuttongroup.html#buttonClicked">buttonClicked</a>() which emits
the id of the button. The id <tt>-1</tt> is reserved by
QButtonGroup to mean "no such button". The purpose of the mapping
mechanism is to simplify the representation of enum values in a
user interface.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QButtonGroup" />QButtonGroup.__init__ (<i>self</i>, <a href="qobject.html">QObject</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 a new, empty button group with the given
<i>parent</i>.</p>
<p><b>See also</b> <a href="qbuttongroup.html#addButton">addButton</a>() and <a href="qbuttongroup.html#exclusive-prop">setExclusive</a>().</p>
<h3 class="fn"><a name="addButton" />QButtonGroup.addButton (<i>self</i>, <a href="qabstractbutton.html">QAbstractButton</a>)</h3><p>Adds the given <i>button</i> to the end of the group's internal
list of buttons. An id will be assigned to the button by this
<a href="qbuttongroup.html">QButtonGroup</a>. Automatically
assigned ids are guaranteed to be negative, starting with -2. If
you are also assigning your own ids, use positive values to avoid
conflicts.</p>
<p><b>See also</b> <a href="qbuttongroup.html#removeButton">removeButton</a>() and <a href="qbuttongroup.html#buttons">buttons</a>().</p>
<h3 class="fn"><a name="addButton-2" />QButtonGroup.addButton (<i>self</i>, <a href="qabstractbutton.html">QAbstractButton</a>, int <i>id</i>)</h3><p>Adds the given <i>button</i> to the button group, with the given
<i>id</i>. It is recommended to assign only positive ids.</p>
<p><b>See also</b> <a href="qbuttongroup.html#removeButton">removeButton</a>() and <a href="qbuttongroup.html#buttons">buttons</a>().</p>
<h3 class="fn"><a name="button" /><a href="qabstractbutton.html">QAbstractButton</a> QButtonGroup.button (<i>self</i>, int <i>id</i>)</h3><p>Returns the button with the specified <i>id</i>, or 0 if no such
button exists.</p>
<p>This function was introduced in Qt 4.1.</p>
<h3 class="fn"><a name="buttons" />unknown-type QButtonGroup.buttons (<i>self</i>)</h3><p>Returns the list of this groups's buttons. This may be
empty.</p>
<p><b>See also</b> <a href="qbuttongroup.html#addButton">addButton</a>() and <a href="qbuttongroup.html#removeButton">removeButton</a>().</p>
<h3 class="fn"><a name="checkedButton" /><a href="qabstractbutton.html">QAbstractButton</a> QButtonGroup.checkedButton (<i>self</i>)</h3><p>Returns the button group's checked button, or 0 if no buttons
are checked.</p>
<p><b>See also</b> <a href="qbuttongroup.html#buttonClicked">buttonClicked</a>().</p>
<h3 class="fn"><a name="checkedId" />int QButtonGroup.checkedId (<i>self</i>)</h3><p>Returns the id of the <a href="qbuttongroup.html#checkedButton">checkedButton</a>(), or -1 if no
button is checked.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qbuttongroup.html#setId">setId</a>().</p>
<h3 class="fn"><a name="exclusive" />bool QButtonGroup.exclusive (<i>self</i>)</h3><h3 class="fn"><a name="id" />int QButtonGroup.id (<i>self</i>, <a href="qabstractbutton.html">QAbstractButton</a> <i>button</i>)</h3><p>Returns the id for the specified <i>button</i>, or -1 if no such
button exists.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qbuttongroup.html#setId">setId</a>().</p>
<h3 class="fn"><a name="removeButton" />QButtonGroup.removeButton (<i>self</i>, <a href="qabstractbutton.html">QAbstractButton</a>)</h3><p>Removes the given <i>button</i> from the button group.</p>
<p><b>See also</b> <a href="qbuttongroup.html#addButton">addButton</a>() and <a href="qbuttongroup.html#buttons">buttons</a>().</p>
<h3 class="fn"><a name="setExclusive" />QButtonGroup.setExclusive (<i>self</i>, bool)</h3><h3 class="fn"><a name="setId" />QButtonGroup.setId (<i>self</i>, <a href="qabstractbutton.html">QAbstractButton</a> <i>button</i>, int <i>id</i>)</h3><p>Sets the <i>id</i> for the specified <i>button</i>. Note that
<i>id</i> can not be -1.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qbuttongroup.html#id">id</a>().</p>
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="buttonClicked" />void buttonClicked ( ::QAbstractButton*)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the given <i>button</i> is clicked.
A button is clicked when it is first pressed and then released,
when its shortcut key is typed, or programmatically when <a href="qabstractbutton.html#click">QAbstractButton.click</a>() or
<a href="qabstractbutton.html#animateClick">QAbstractButton.animateClick</a>()
is called.</p>
<p><b>See also</b> <a href="qbuttongroup.html#checkedButton">checkedButton</a>() and <a href="qabstractbutton.html#clicked">QAbstractButton.clicked</a>().</p>
<h3 class="fn"><a name="buttonClicked-2" />void buttonClicked (int)</h3><p>This signal is emitted when a button with the given <i>id</i> is
clicked.</p>
<p><b>See also</b> <a href="qbuttongroup.html#checkedButton">checkedButton</a>() and <a href="qabstractbutton.html#clicked">QAbstractButton.clicked</a>().</p>
<h3 class="fn"><a name="buttonPressed" />void buttonPressed ( ::QAbstractButton*)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the given <i>button</i> is pressed
down.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qabstractbutton.html#pressed">QAbstractButton.pressed</a>().</p>
<h3 class="fn"><a name="buttonPressed-2" />void buttonPressed (int)</h3><p>This signal is emitted when a button with the given <i>id</i> is
pressed down.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qabstractbutton.html#pressed">QAbstractButton.pressed</a>().</p>
<h3 class="fn"><a name="buttonReleased" />void buttonReleased ( ::QAbstractButton*)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the given <i>button</i> is
released.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qabstractbutton.html#released">QAbstractButton.released</a>().</p>
<h3 class="fn"><a name="buttonReleased-2" />void buttonReleased (int)</h3><p>This signal is emitted when a button with the given <i>id</i> is
released.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qabstractbutton.html#released">QAbstractButton.released</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.12.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt 4.8.7</td></tr></table></div></address></body></html>
|