<?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>QGroupBox 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">QGroupBox Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QGroupBox widget provides a group box frame with a title. <a href="#details">More...</a></p> <p>Inherits <a href="qwidget.html">QWidget</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qgroupbox.html#QGroupBox">__init__</a></b> (<i>self</i>, QWidget <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qgroupbox.html#QGroupBox-2">__init__</a></b> (<i>self</i>, QString <i>title</i>, QWidget <i>parent</i> = None)</li><li><div class="fn" />Qt.Alignment <b><a href="qgroupbox.html#alignment">alignment</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qgroupbox.html#changeEvent">changeEvent</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" /><b><a href="qgroupbox.html#childEvent">childEvent</a></b> (<i>self</i>, QChildEvent)</li><li><div class="fn" />bool <b><a href="qgroupbox.html#event">event</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" /><b><a href="qgroupbox.html#focusInEvent">focusInEvent</a></b> (<i>self</i>, QFocusEvent)</li><li><div class="fn" /><b><a href="qgroupbox.html#initStyleOption">initStyleOption</a></b> (<i>self</i>, QStyleOptionGroupBox <i>option</i>)</li><li><div class="fn" />bool <b><a href="qgroupbox.html#isCheckable">isCheckable</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qgroupbox.html#isChecked">isChecked</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qgroupbox.html#isFlat">isFlat</a></b> (<i>self</i>)</li><li><div class="fn" />QSize <b><a href="qgroupbox.html#minimumSizeHint">minimumSizeHint</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qgroupbox.html#mouseMoveEvent">mouseMoveEvent</a></b> (<i>self</i>, QMouseEvent <i>event</i>)</li><li><div class="fn" /><b><a href="qgroupbox.html#mousePressEvent">mousePressEvent</a></b> (<i>self</i>, QMouseEvent <i>event</i>)</li><li><div class="fn" /><b><a href="qgroupbox.html#mouseReleaseEvent">mouseReleaseEvent</a></b> (<i>self</i>, QMouseEvent <i>event</i>)</li><li><div class="fn" /><b><a href="qgroupbox.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent)</li><li><div class="fn" /><b><a href="qgroupbox.html#resizeEvent">resizeEvent</a></b> (<i>self</i>, QResizeEvent)</li><li><div class="fn" /><b><a href="qgroupbox.html#setAlignment">setAlignment</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qgroupbox.html#setCheckable">setCheckable</a></b> (<i>self</i>, bool <i>b</i>)</li><li><div class="fn" /><b><a href="qgroupbox.html#setChecked">setChecked</a></b> (<i>self</i>, bool <i>b</i>)</li><li><div class="fn" /><b><a href="qgroupbox.html#setFlat">setFlat</a></b> (<i>self</i>, bool <i>b</i>)</li><li><div class="fn" /><b><a href="qgroupbox.html#setTitle">setTitle</a></b> (<i>self</i>, QString)</li><li><div class="fn" />QString <b><a href="qgroupbox.html#title">title</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qgroupbox.html#clicked">clicked</a></b> (bool = 0)</li><li><div class="fn" />void <b><a href="qgroupbox.html#toggled">toggled</a></b> (bool)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QGroupBox widget provides a group box frame with a title.</p> <p>A group box provides a frame, a title and a keyboard shortcut, and displays various other widgets inside itself. The title is on top, the keyboard shortcut moves keyboard focus to one of the group box's child widgets.</p> <p>QGroupBox also lets you set the <a href="qgroupbox.html#title-prop">title</a> (normally set in the constructor) and the title's <a href="qgroupbox.html#alignment-prop">alignment</a>. Group boxes can be <a href="qgroupbox.html#checkable-prop">checkable</a>; child widgets in checkable group boxes are enabled or disabled depending on whether or not the group box is <a href="qgroupbox.html#checked-prop">checked</a>.</p> <p>You can minimize the space consumption of a group box by enabling the <a href="qgroupbox.html#flat-prop">flat</a> property. In most <a href="qstyle.html">styles</a>, enabling this property results in the removal of the left, right and bottom edges of the frame.</p> <p>QGroupBox doesn't automatically lay out the child widgets (which are often <a href="qcheckbox.html">QCheckBox</a>es or <a href="qradiobutton.html">QRadioButton</a>s but can be any widgets). The following example shows how we can set up a QGroupBox with a layout:</p> <pre class="cpp"> <span class="type">QGroupBox</span> <span class="operator">*</span>groupBox <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QGroupBox</span>(tr(<span class="string">"Exclusive Radio Buttons"</span>)); <span class="type"><a href="qradiobutton.html">QRadioButton</a></span> <span class="operator">*</span>radio1 <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qradiobutton.html">QRadioButton</a></span>(tr(<span class="string">"&Radio button 1"</span>)); <span class="type"><a href="qradiobutton.html">QRadioButton</a></span> <span class="operator">*</span>radio2 <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qradiobutton.html">QRadioButton</a></span>(tr(<span class="string">"R&adio button 2"</span>)); <span class="type"><a href="qradiobutton.html">QRadioButton</a></span> <span class="operator">*</span>radio3 <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qradiobutton.html">QRadioButton</a></span>(tr(<span class="string">"Ra&dio button 3"</span>)); radio1<span class="operator">-</span><span class="operator">></span>setChecked(<span class="keyword">true</span>); <span class="type"><a href="qvboxlayout.html">QVBoxLayout</a></span> <span class="operator">*</span>vbox <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qvboxlayout.html">QVBoxLayout</a></span>; vbox<span class="operator">-</span><span class="operator">></span>addWidget(radio1); vbox<span class="operator">-</span><span class="operator">></span>addWidget(radio2); vbox<span class="operator">-</span><span class="operator">></span>addWidget(radio3); vbox<span class="operator">-</span><span class="operator">></span>addStretch(<span class="number">1</span>); groupBox<span class="operator">-</span><span class="operator">></span>setLayout(vbox); </pre> <table class="generic" width="100%"> <tr class="odd" valign="top"> <td><img alt="Screenshot of a Windows XP style group box" src="images/windowsxp-groupbox.png" /></td> <td><img alt="Screenshot of a Macintosh style group box" src="images/macintosh-groupbox.png" /></td> <td><img alt="Screenshot of a Plastique style group box" src="images/plastique-groupbox.png" /></td> </tr> <tr class="even" valign="top"> <td>A <a href="gallery-windowsxp.html">Windows XP style</a> group box.</td> <td>A <a href="gallery-macintosh.html">Macintosh style</a> group box.</td> <td>A <a href="gallery-plastique.html">Plastique style</a> group box.</td> </tr> </table> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QGroupBox" />QGroupBox.__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 a group box widget with the given <i>parent</i> but with no title.</p> <h3 class="fn"><a name="QGroupBox-2" />QGroupBox.__init__ (<i>self</i>, QString <i>title</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 a group box with the given <i>title</i> and <i>parent</i>.</p> <h3 class="fn"><a name="alignment" /><a href="qt-alignment.html">Qt.Alignment</a> QGroupBox.alignment (<i>self</i>)</h3><h3 class="fn"><a name="changeEvent" />QGroupBox.changeEvent (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#changeEvent">QWidget.changeEvent</a>().</p> <h3 class="fn"><a name="childEvent" />QGroupBox.childEvent (<i>self</i>, <a href="qchildevent.html">QChildEvent</a>)</h3><p>Reimplemented from <a href="qobject.html#childEvent">QObject.childEvent</a>().</p> <h3 class="fn"><a name="event" />bool QGroupBox.event (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p> <h3 class="fn"><a name="focusInEvent" />QGroupBox.focusInEvent (<i>self</i>, <a href="qfocusevent.html">QFocusEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#focusInEvent">QWidget.focusInEvent</a>().</p> <h3 class="fn"><a name="initStyleOption" />QGroupBox.initStyleOption (<i>self</i>, <a href="qstyleoptiongroupbox.html">QStyleOptionGroupBox</a> <i>option</i>)</h3><p>Initialize <i>option</i> with the values from this <a href="qgroupbox.html">QGroupBox</a>. This method is useful for subclasses when they need a <a href="qstyleoptiongroupbox.html">QStyleOptionGroupBox</a>, but don't want to fill in all the information themselves.</p> <p><b>See also</b> <a href="qstyleoption.html#initFrom">QStyleOption.initFrom</a>().</p> <h3 class="fn"><a name="isCheckable" />bool QGroupBox.isCheckable (<i>self</i>)</h3><h3 class="fn"><a name="isChecked" />bool QGroupBox.isChecked (<i>self</i>)</h3><h3 class="fn"><a name="isFlat" />bool QGroupBox.isFlat (<i>self</i>)</h3><h3 class="fn"><a name="minimumSizeHint" /><a href="qsize.html">QSize</a> QGroupBox.minimumSizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#minimumSizeHint-prop">QWidget.minimumSizeHint</a>().</p> <h3 class="fn"><a name="mouseMoveEvent" />QGroupBox.mouseMoveEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qwidget.html#mouseMoveEvent">QWidget.mouseMoveEvent</a>().</p> <h3 class="fn"><a name="mousePressEvent" />QGroupBox.mousePressEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qwidget.html#mousePressEvent">QWidget.mousePressEvent</a>().</p> <h3 class="fn"><a name="mouseReleaseEvent" />QGroupBox.mouseReleaseEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qwidget.html#mouseReleaseEvent">QWidget.mouseReleaseEvent</a>().</p> <h3 class="fn"><a name="paintEvent" />QGroupBox.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>().</p> <h3 class="fn"><a name="resizeEvent" />QGroupBox.resizeEvent (<i>self</i>, <a href="qresizeevent.html">QResizeEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#resizeEvent">QWidget.resizeEvent</a>().</p> <h3 class="fn"><a name="setAlignment" />QGroupBox.setAlignment (<i>self</i>, int)</h3><h3 class="fn"><a name="setCheckable" />QGroupBox.setCheckable (<i>self</i>, bool <i>b</i>)</h3><h3 class="fn"><a name="setChecked" />QGroupBox.setChecked (<i>self</i>, bool <i>b</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setChecked(bool)</tt>.</p><h3 class="fn"><a name="setFlat" />QGroupBox.setFlat (<i>self</i>, bool <i>b</i>)</h3><h3 class="fn"><a name="setTitle" />QGroupBox.setTitle (<i>self</i>, QString)</h3><h3 class="fn"><a name="title" />QString QGroupBox.title (<i>self</i>)</h3><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 check box is activated (i.e. pressed down then released while the mouse cursor is inside the button), or when the shortcut key is typed, Notably, this signal is <i>not</i> emitted if you call <a href="qgroupbox.html#checked-prop">setChecked</a>().</p> <p>If the check box is checked <i>checked</i> is true; it is false if the check box is unchecked.</p> <p>This function was introduced in Qt 4.2.</p> <p><b>See also</b> <a href="qgroupbox.html#checkable-prop">checkable</a>, <a href="qgroupbox.html#toggled">toggled</a>(), and <a href="qgroupbox.html#checked-prop">checked</a>.</p> <h3 class="fn"><a name="toggled" />void toggled (bool)</h3><p>This is the default overload of this signal.</p><p>If the group box is checkable, this signal is emitted when the check box is toggled. <i>on</i> is true if the check box is checked; otherwise it is false.</p> <p><b>See also</b> <a href="qgroupbox.html#checkable-prop">checkable</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>