qgroupbox.html 30.2 KB
Newer Older
xuebingbing's avatar
xuebingbing committed
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 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qgroupbox.cpp -->
  <title>QGroupBox Class | Qt Widgets 5.11</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 ><a href="../qtdoc/index.html">Qt 5.11</a></td><td ><a href="qtwidgets-index.html">Qt Widgets</a></td><td ><a href="qtwidgets-module.html">C++ Classes</a></td><td >QGroupBox</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.11.2 Reference Documentation</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="#reimplemented-public-functions">Reimplemented 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="#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">QGroupBox Class</h1>
<!-- $$$QGroupBox-brief -->
<p>The <a href="qgroupbox.html">QGroupBox</a> widget provides a group box frame with a title. <a href="#details">More...</a></p>
<!-- @@@QGroupBox -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QGroupBox&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></table></div><ul>
<li><a href="qgroupbox-members.html">List of all members, including inherited 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="qgroupbox.html#alignment-prop">alignment</a></b> : Qt::Alignment</li>
<li class="fn"><b><a href="qgroupbox.html#checkable-prop">checkable</a></b> : bool</li>
<li class="fn"><b><a href="qgroupbox.html#checked-prop">checked</a></b> : bool</li>
</ul></td><td class="topAlign"><ul>
<li class="fn"><b><a href="qgroupbox.html#flat-prop">flat</a></b> : bool</li>
<li class="fn"><b><a href="qgroupbox.html#title-prop">title</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="qgroupbox.html#QGroupBox">QGroupBox</a></b>(QWidget *<i>parent</i> = nullptr)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qgroupbox.html#QGroupBox-1">QGroupBox</a></b>(const QString &amp;<i>title</i>, QWidget *<i>parent</i> = nullptr)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qgroupbox.html#dtor.QGroupBox">~QGroupBox</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::Alignment </td><td class="memItemRight bottomAlign"><b><a href="qgroupbox.html#alignment-prop">alignment</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qgroupbox.html#checkable-prop">isCheckable</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qgroupbox.html#checked-prop">isChecked</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qgroupbox.html#flat-prop">isFlat</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgroupbox.html#alignment-prop">setAlignment</a></b>(int <i>alignment</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgroupbox.html#checkable-prop">setCheckable</a></b>(bool <i>checkable</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgroupbox.html#flat-prop">setFlat</a></b>(bool <i>flat</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgroupbox.html#title-prop">setTitle</a></b>(const QString &amp;<i>title</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qgroupbox.html#title-prop">title</a></b>() const</td></tr>
</table></div>
<a name="reimplemented-public-functions"></a>
<h2 id="reimplemented-public-functions">Reimplemented Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual QSize </td><td class="memItemRight bottomAlign"><b><a href="qgroupbox.html#minimumSizeHint">minimumSizeHint</a></b>() const override</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">34 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="qgroupbox.html#checked-prop">setChecked</a></b>(bool <i>checked</i>)</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="qgroupbox.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="qgroupbox.html#toggled">toggled</a></b>(bool <i>on</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="protected-functions"></a>
<h2 id="protected-functions">Protected Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgroupbox.html#initStyleOption">initStyleOption</a></b>(QStyleOptionGroupBox *<i>option</i>) const</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="qgroupbox.html#changeEvent">changeEvent</a></b>(QEvent *<i>ev</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgroupbox.html#childEvent">childEvent</a></b>(QChildEvent *<i>c</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qgroupbox.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="qgroupbox.html#focusInEvent">focusInEvent</a></b>(QFocusEvent *<i>fe</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgroupbox.html#mouseMoveEvent">mouseMoveEvent</a></b>(QMouseEvent *<i>event</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgroupbox.html#mousePressEvent">mousePressEvent</a></b>(QMouseEvent *<i>event</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgroupbox.html#mouseReleaseEvent">mouseReleaseEvent</a></b>(QMouseEvent *<i>event</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgroupbox.html#paintEvent">paintEvent</a></b>(QPaintEvent *<i>event</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgroupbox.html#resizeEvent">resizeEvent</a></b>(QResizeEvent *<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 public variable inherited from <a href="../qtcore/qobject.html#public-variables">QObject</a></li>
<li class="fn">5 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li>
<li class="fn">10 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">QObject</a></li>
<li class="fn">1 protected slot inherited from <a href="qwidget.html#protected-slots">QWidget</a></li>
<li class="fn">2 protected variables inherited from <a href="../qtcore/qobject.html#protected-variables">QObject</a></li>
<li class="fn">1 protected type inherited from <a href="../qtgui/qpaintdevice.html#protected-variables">QPaintDevice</a></li>
</ul>
<a name="details"></a>
<!-- $$$QGroupBox-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qgroupbox.html">QGroupBox</a> widget provides a group box frame with a title.</p>
<p class="centerAlign"><img src="images/windows-groupbox.png" alt="" /></p><p>A group box provides a frame, a title on top, a keyboard shortcut, and displays various other widgets inside itself. The keyboard shortcut moves keyboard focus to one of the group box's child widgets.</p>
<p><a href="qgroupbox.html">QGroupBox</a> also lets you set the <a href="qgroupbox.html#title-prop">title</a> (normally set in the constructor) and the title's <a href="stylesheet-reference.html#alignment">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><a href="qgroupbox.html">QGroupBox</a> 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 <a href="qgroupbox.html">QGroupBox</a> with a layout:</p>
<pre class="cpp">

      <span class="type"><a href="qgroupbox.html#QGroupBox">QGroupBox</a></span> <span class="operator">*</span>groupBox <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgroupbox.html#QGroupBox">QGroupBox</a></span>(tr(<span class="string">&quot;Exclusive Radio Buttons&quot;</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">&quot;&amp;Radio button 1&quot;</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">&quot;R&amp;adio button 2&quot;</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">&quot;Ra&amp;dio button 3&quot;</span>));

      radio1<span class="operator">-</span><span class="operator">&gt;</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">&gt;</span>addWidget(radio1);
      vbox<span class="operator">-</span><span class="operator">&gt;</span>addWidget(radio2);
      vbox<span class="operator">-</span><span class="operator">&gt;</span>addWidget(radio3);
      vbox<span class="operator">-</span><span class="operator">&gt;</span>addStretch(<span class="number">1</span>);
      groupBox<span class="operator">-</span><span class="operator">&gt;</span>setLayout(vbox);

</pre>
</div>
<p><b>See also </b><a href="qbuttongroup.html">QButtonGroup</a> and <a href="qtwidgets-widgets-groupbox-example.html">Group Box Example</a>.</p>
<!-- @@@QGroupBox -->
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$alignment-prop$$$alignment$$$setAlignmentint -->
<h3 class="fn" id="alignment-prop"><a name="alignment-prop"></a><span class="name">alignment</span> : <span class="type">Qt::Alignment</span></h3>
<p>This property holds the alignment of the group box title.</p>
<p>Most styles place the title at the top of the frame. The horizontal alignment of the title can be specified using single values from the following list:</p>
<ul>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignLeft</a> aligns the title text with the left-hand side of the group box.</li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignRight</a> aligns the title text with the right-hand side of the group box.</li>
<li><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignHCenter</a> aligns the title text with the horizontal center of the group box.</li>
</ul>
<p>The default alignment is <a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignLeft</a>.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> Qt::Alignment </td><td class="memItemRight bottomAlign"><span class="name"><b>alignment</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setAlignment</b></span>(int <i>alignment</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::Alignment</a>.</p>
<!-- @@@alignment -->
<!-- $$$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 group box has a checkbox in its title</p>
<p>If this property is <code>true</code>, the group box displays its title using a checkbox in place of an ordinary label. If the checkbox is checked, the group box's children are enabled; otherwise, they are disabled and inaccessible.</p>
<p>By default, group boxes are not checkable.</p>
<p>If this property is enabled for a group box, it will also be initially checked to ensure that its contents are enabled.</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>(bool <i>checkable</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qgroupbox.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 group box is checked</p>
<p>If the group box is checkable, it is displayed with a check box. If the check box is checked, the group box's children are enabled; otherwise, the children are disabled and are inaccessible to the user.</p>
<p>By default, checkable group boxes are also checked.</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>(bool <i>checked</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="qgroupbox.html#toggled">toggled</a></b></span>(bool <i>on</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qgroupbox.html#checkable-prop">checkable</a>.</p>
<!-- @@@checked -->
<!-- $$$flat-prop$$$isFlat$$$setFlatbool -->
<h3 class="fn" id="flat-prop"><a name="flat-prop"></a><span class="name">flat</span> : <span class="type">bool</span></h3>
<p>This property holds whether the group box is painted flat or has a frame</p>
<p>A group box usually consists of a surrounding frame with a title at the top. If this property is enabled, only the top part of the frame is drawn in most styles; otherwise, the whole frame is drawn.</p>
<p>By default, this property is disabled, i.e&#x2e;, group boxes are not flat unless explicitly specified.</p>
<p><b>Note:</b> In some styles, flat and non-flat group boxes have similar representations and may not be as distinguishable as they are in other styles.</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>isFlat</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setFlat</b></span>(bool <i>flat</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qgroupbox.html#title-prop">title</a>.</p>
<!-- @@@flat -->
<!-- $$$title-prop$$$title$$$setTitleconstQString& -->
<h3 class="fn" id="title-prop"><a name="title-prop"></a><span class="name">title</span> : <span class="type"><a href="../qtcore/qstring.html">QString</a></span></h3>
<p>This property holds the group box title text</p>
<p>The group box title text will have a keyboard shortcut if the title contains an ampersand ('&amp;') followed by a letter.</p>
<pre class="cpp">

  g<span class="operator">-</span><span class="operator">&gt;</span>setTitle(<span class="string">&quot;&amp;User information&quot;</span>);

</pre>
<p>In the example above, <b>Alt+U</b> moves the keyboard focus to the group box. 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 title 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>title</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setTitle</b></span>(const QString &amp;<i>title</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="stylesheet-reference.html#alignment">alignment</a>.</p>
<!-- @@@title -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QGroupBox[overload1]$$$QGroupBoxQWidget* -->
<h3 class="fn" id="QGroupBox"><a name="QGroupBox"></a>QGroupBox::<span class="name">QGroupBox</span>(<span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>parent</i> = nullptr)</h3>
<p>Constructs a group box widget with the given <i>parent</i> but with no title.</p>
<!-- @@@QGroupBox -->
<!-- $$$QGroupBox$$$QGroupBoxconstQString&QWidget* -->
<h3 class="fn" id="QGroupBox-1"><a name="QGroupBox-1"></a>QGroupBox::<span class="name">QGroupBox</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>title</i>, <span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>parent</i> = nullptr)</h3>
<p>Constructs a group box with the given <i>title</i> and <i>parent</i>.</p>
<!-- @@@QGroupBox -->
<!-- $$$~QGroupBox[overload1]$$$~QGroupBox -->
<h3 class="fn" id="dtor.QGroupBox"><a name="dtor.QGroupBox"></a><code>[virtual] </code>QGroupBox::<span class="name">~QGroupBox</span>()</h3>
<p>Destroys the group box.</p>
<!-- @@@~QGroupBox -->
<!-- $$$changeEvent[overload1]$$$changeEventQEvent* -->
<h3 class="fn" id="changeEvent"><a name="changeEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QGroupBox::<span class="name">changeEvent</span>(<span class="type"><a href="../qtcore/qevent.html">QEvent</a></span> *<i>ev</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#changeEvent">QWidget::changeEvent</a>().</p>
<!-- @@@changeEvent -->
<!-- $$$childEvent[overload1]$$$childEventQChildEvent* -->
<h3 class="fn" id="childEvent"><a name="childEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QGroupBox::<span class="name">childEvent</span>(<span class="type"><a href="../qtcore/qchildevent.html">QChildEvent</a></span> *<i>c</i>)</h3>
<p>Reimplemented from <a href="../qtcore/qobject.html#childEvent">QObject::childEvent</a>().</p>
<!-- @@@childEvent -->
<!-- $$$clicked[overload1]$$$clickedbool -->
<h3 class="fn" id="clicked"><a name="clicked"></a><code>[signal] </code><span class="type">void</span> QGroupBox::<span class="name">clicked</span>(<span class="type">bool</span> <i>checked</i> = false)</h3>
<p>This signal is emitted when the check box is activated (i.e&#x2e;, 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>
<!-- @@@clicked -->
<!-- $$$event[overload1]$$$eventQEvent* -->
<h3 class="fn" id="event"><a name="event"></a><code>[override virtual protected] </code><span class="type">bool</span> QGroupBox::<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> QGroupBox::<span class="name">focusInEvent</span>(<span class="type"><a href="../qtgui/qfocusevent.html">QFocusEvent</a></span> *<i>fe</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#focusInEvent">QWidget::focusInEvent</a>().</p>
<!-- @@@focusInEvent -->
<!-- $$$initStyleOption[overload1]$$$initStyleOptionQStyleOptionGroupBox* -->
<h3 class="fn" id="initStyleOption"><a name="initStyleOption"></a><code>[protected] </code><span class="type">void</span> QGroupBox::<span class="name">initStyleOption</span>(<span class="type"><a href="qstyleoptiongroupbox.html">QStyleOptionGroupBox</a></span> *<i>option</i>) const</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>
<!-- @@@initStyleOption -->
<!-- $$$minimumSizeHint[overload1]$$$minimumSizeHint -->
<h3 class="fn" id="minimumSizeHint"><a name="minimumSizeHint"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qsize.html">QSize</a></span> QGroupBox::<span class="name">minimumSizeHint</span>() const</h3>
<p>Reimplemented from <a href="qwidget.html#minimumSizeHint-prop">QWidget::minimumSizeHint</a>().</p>
<!-- @@@minimumSizeHint -->
<!-- $$$mouseMoveEvent[overload1]$$$mouseMoveEventQMouseEvent* -->
<h3 class="fn" id="mouseMoveEvent"><a name="mouseMoveEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QGroupBox::<span class="name">mouseMoveEvent</span>(<span class="type"><a href="../qtgui/qmouseevent.html">QMouseEvent</a></span> *<i>event</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> QGroupBox::<span class="name">mousePressEvent</span>(<span class="type"><a href="../qtgui/qmouseevent.html">QMouseEvent</a></span> *<i>event</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> QGroupBox::<span class="name">mouseReleaseEvent</span>(<span class="type"><a href="../qtgui/qmouseevent.html">QMouseEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#mouseReleaseEvent">QWidget::mouseReleaseEvent</a>().</p>
<!-- @@@mouseReleaseEvent -->
<!-- $$$paintEvent[overload1]$$$paintEventQPaintEvent* -->
<h3 class="fn" id="paintEvent"><a name="paintEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QGroupBox::<span class="name">paintEvent</span>(<span class="type"><a href="../qtgui/qpaintevent.html">QPaintEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget::paintEvent</a>().</p>
<!-- @@@paintEvent -->
<!-- $$$resizeEvent[overload1]$$$resizeEventQResizeEvent* -->
<h3 class="fn" id="resizeEvent"><a name="resizeEvent"></a><code>[override virtual protected] </code><span class="type">void</span> QGroupBox::<span class="name">resizeEvent</span>(<span class="type"><a href="../qtgui/qresizeevent.html">QResizeEvent</a></span> *<i>e</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#resizeEvent">QWidget::resizeEvent</a>().</p>
<!-- @@@resizeEvent -->
<!-- $$$toggled -->
<h3 class="fn" id="toggled"><a name="toggled"></a><code>[signal] </code><span class="type">void</span> QGroupBox::<span class="name">toggled</span>(<span class="type">bool</span> <i>on</i>)</h3>
<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>Note:</b> Notifier signal for property <a href="qgroupbox.html#checked-prop">checked</a>. </p><p><b>See also </b><a href="qgroupbox.html#checkable-prop">checkable</a>.</p>
<!-- @@@toggled -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2018 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>