source: trunk/doc/html/qgroupbox.html

Last change on this file was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 20.5 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qgroupbox.cpp:56 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QGroupBox Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QGroupBox Class Reference</h1>
33
34<p>The QGroupBox widget provides a group box frame with a title.
35<a href="#details">More...</a>
36<p><tt>#include &lt;<a href="qgroupbox-h.html">qgroupbox.h</a>&gt;</tt>
37<p>Inherits <a href="qframe.html">QFrame</a>.
38<p>Inherited by <a href="qbuttongroup.html">QButtonGroup</a>, <a href="qhgroupbox.html">QHGroupBox</a>, and <a href="qvgroupbox.html">QVGroupBox</a>.
39<p><a href="qgroupbox-members.html">List of all member functions.</a>
40<h2>Public Members</h2>
41<ul>
42<li class=fn><a href="#QGroupBox"><b>QGroupBox</b></a> ( QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
43<li class=fn><a href="#QGroupBox-2"><b>QGroupBox</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;title, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
44<li class=fn><a href="#QGroupBox-3"><b>QGroupBox</b></a> ( int&nbsp;strips, Orientation&nbsp;orientation, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
45<li class=fn><a href="#QGroupBox-4"><b>QGroupBox</b></a> ( int&nbsp;strips, Orientation&nbsp;orientation, const&nbsp;QString&nbsp;&amp;&nbsp;title, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
46<li class=fn><a href="#~QGroupBox"><b>~QGroupBox</b></a> ()</li>
47<li class=fn>virtual void <a href="#setColumnLayout"><b>setColumnLayout</b></a> ( int&nbsp;strips, Orientation&nbsp;direction )</li>
48<li class=fn>QString <a href="#title"><b>title</b></a> () const</li>
49<li class=fn>virtual void <a href="#setTitle"><b>setTitle</b></a> ( const QString &amp; )</li>
50<li class=fn>int <a href="#alignment"><b>alignment</b></a> () const</li>
51<li class=fn>virtual void <a href="#setAlignment"><b>setAlignment</b></a> ( int )</li>
52<li class=fn>int <a href="#columns"><b>columns</b></a> () const</li>
53<li class=fn>void <a href="#setColumns"><b>setColumns</b></a> ( int )</li>
54<li class=fn>Orientation <a href="#orientation"><b>orientation</b></a> () const</li>
55<li class=fn>void <a href="#setOrientation"><b>setOrientation</b></a> ( Orientation )</li>
56<li class=fn>int <a href="#insideMargin"><b>insideMargin</b></a> () const</li>
57<li class=fn>int <a href="#insideSpacing"><b>insideSpacing</b></a> () const</li>
58<li class=fn>void <a href="#setInsideMargin"><b>setInsideMargin</b></a> ( int&nbsp;m )</li>
59<li class=fn>void <a href="#setInsideSpacing"><b>setInsideSpacing</b></a> ( int&nbsp;s )</li>
60<li class=fn>void <a href="#addSpace"><b>addSpace</b></a> ( int&nbsp;size )</li>
61<li class=fn>bool <a href="#isFlat"><b>isFlat</b></a> () const</li>
62<li class=fn>void <a href="#setFlat"><b>setFlat</b></a> ( bool&nbsp;b )</li>
63<li class=fn>bool <a href="#isCheckable"><b>isCheckable</b></a> () const</li>
64<li class=fn>void <a href="#setCheckable"><b>setCheckable</b></a> ( bool&nbsp;b )</li>
65<li class=fn>bool <a href="#isChecked"><b>isChecked</b></a> () const</li>
66</ul>
67<h2>Public Slots</h2>
68<ul>
69<li class=fn>void <a href="#setChecked"><b>setChecked</b></a> ( bool&nbsp;b )</li>
70</ul>
71<h2>Signals</h2>
72<ul>
73<li class=fn>void <a href="#toggled"><b>toggled</b></a> ( bool&nbsp;on )</li>
74</ul>
75<h2>Properties</h2>
76<ul>
77<li class=fn>Alignment <a href="#alignment-prop"><b>alignment</b></a>&nbsp;- the alignment of the group box title</li>
78<li class=fn>bool <a href="#checkable-prop"><b>checkable</b></a>&nbsp;- whether the group box has a checkbox in its title</li>
79<li class=fn>bool <a href="#checked-prop"><b>checked</b></a>&nbsp;- whether the group box's checkbox is checked</li>
80<li class=fn>int <a href="#columns-prop"><b>columns</b></a>&nbsp;- the number of columns or rows (depending on \l QGroupBox::orientation) in the group box</li>
81<li class=fn>bool <a href="#flat-prop"><b>flat</b></a>&nbsp;- whether the group box is painted flat or has a frame</li>
82<li class=fn>Orientation <a href="#orientation-prop"><b>orientation</b></a>&nbsp;- the group box's orientation</li>
83<li class=fn>QString <a href="#title-prop"><b>title</b></a>&nbsp;- the group box title text</li>
84</ul>
85<hr><a name="details"></a><h2>Detailed Description</h2>
86
87
88The QGroupBox widget provides a group box frame with a title.
89<p>
90
91
92
93<p> A group box provides a frame, a title and a keyboard shortcut, and
94displays various other widgets inside itself. The title is on top,
95the keyboard shortcut moves <a href="focus.html#keyboard-focus">keyboard focus</a> to one of the group
96box's child widgets, and the child widgets are usually laid out
97horizontally (or vertically) inside the frame.
98<p> The simplest way to use it is to create a group box with the
99desired number of columns (or rows) and orientation, and then just
100create widgets with the group box as parent.
101<p> It is also possible to change the <a href="#orientation">orientation</a>() and number of
102<a href="#columns">columns</a>() after construction, or to ignore all the automatic
103layout support and manage the layout yourself. You can add 'empty'
104spaces to the group box with <a href="#addSpace">addSpace</a>().
105<p> QGroupBox also lets you set the <a href="#title">title</a>() (normally set in the
106constructor) and the title's <a href="#alignment">alignment</a>().
107<p> You can change the spacing used by the group box with
108<a href="#setInsideMargin">setInsideMargin</a>() and <a href="#setInsideSpacing">setInsideSpacing</a>(). To minimize space
109consumption, you can remove the right, left and bottom edges of
110the frame with <a href="#setFlat">setFlat</a>().
111<p> <img src=qgrpbox-w.png>
112<p> <p>See also <a href="qbuttongroup.html">QButtonGroup</a>, <a href="appearance.html">Widget Appearance and Style</a>, <a href="geomanagement.html">Layout Management</a>, and <a href="organizers.html">Organizers</a>.
113
114<hr><h2>Member Function Documentation</h2>
115<h3 class=fn><a name="QGroupBox"></a>QGroupBox::QGroupBox ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
116</h3>
117Constructs a group box widget with no title.
118<p> The <em>parent</em> and <em>name</em> arguments are passed to the <a href="qwidget.html">QWidget</a>
119constructor.
120<p> This constructor does not do automatic layout.
121
122<h3 class=fn><a name="QGroupBox-2"></a>QGroupBox::QGroupBox ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;title, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
123</h3>
124Constructs a group box with the title <em>title</em>.
125<p> The <em>parent</em> and <em>name</em> arguments are passed to the <a href="qwidget.html">QWidget</a>
126constructor.
127<p> This constructor does not do automatic layout.
128
129<h3 class=fn><a name="QGroupBox-3"></a>QGroupBox::QGroupBox ( int&nbsp;strips, <a href="qt.html#Orientation-enum">Orientation</a>&nbsp;orientation, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
130</h3>
131Constructs a group box with no title. Child widgets will be
132arranged in <em>strips</em> rows or columns (depending on <em>orientation</em>).
133<p> The <em>parent</em> and <em>name</em> arguments are passed to the <a href="qwidget.html">QWidget</a>
134constructor.
135
136<h3 class=fn><a name="QGroupBox-4"></a>QGroupBox::QGroupBox ( int&nbsp;strips, <a href="qt.html#Orientation-enum">Orientation</a>&nbsp;orientation, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;title, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
137</h3>
138Constructs a group box titled <em>title</em>. Child widgets will be
139arranged in <em>strips</em> rows or columns (depending on <em>orientation</em>).
140<p> The <em>parent</em> and <em>name</em> arguments are passed to the <a href="qwidget.html">QWidget</a>
141constructor.
142
143<h3 class=fn><a name="~QGroupBox"></a>QGroupBox::~QGroupBox ()
144</h3>
145Destroys the group box.
146
147<h3 class=fn>void <a name="addSpace"></a>QGroupBox::addSpace ( int&nbsp;size )
148</h3>
149Adds an empty cell at the next free position. If <em>size</em> is
150greater than 0, the empty cell takes <em>size</em> to be its fixed width
151(if <a href="#orientation">orientation</a>() is <a href="qt.html#Orientation-enum">Horizontal</a>) or height (if orientation() is
152<a href="qt.html#Orientation-enum">Vertical</a>).
153<p> Use this method to separate the widgets in the group box or to
154skip the next free cell. For performance reasons, call this method
155after calling <a href="#setColumnLayout">setColumnLayout</a>() or by changing the <a href="#columns-prop">QGroupBox::columns</a> or <a href="#orientation-prop">QGroupBox::orientation</a> properties. It is
156generally a good idea to call these methods first (if needed at
157all), and insert the widgets and spaces afterwards.
158
159<h3 class=fn>int <a name="alignment"></a>QGroupBox::alignment () const
160</h3><p>Returns the alignment of the group box title.
161See the <a href="qgroupbox.html#alignment-prop">"alignment"</a> property for details.
162<h3 class=fn>int <a name="columns"></a>QGroupBox::columns () const
163</h3><p>Returns the number of columns or rows (depending on <a href="#orientation-prop">QGroupBox::orientation</a>) in the group box.
164See the <a href="qgroupbox.html#columns-prop">"columns"</a> property for details.
165<h3 class=fn>int <a name="insideMargin"></a>QGroupBox::insideMargin () const
166</h3>
167Returns the width of the empty space between the items in the
168group and the frame of the group.
169<p> Only applies if the group box has a defined orientation.
170<p> The default is usually 11, by may vary depending on the platform
171and style.
172<p> <p>See also <a href="#setInsideMargin">setInsideMargin</a>() and <a href="#orientation-prop">orientation</a>.
173
174<h3 class=fn>int <a name="insideSpacing"></a>QGroupBox::insideSpacing () const
175</h3>
176Returns the width of the empty space between each of the items
177in the group.
178<p> Only applies if the group box has a defined orientation.
179<p> The default is usually 5, by may vary depending on the platform
180and style.
181<p> <p>See also <a href="#setInsideSpacing">setInsideSpacing</a>() and <a href="#orientation-prop">orientation</a>.
182
183<h3 class=fn>bool <a name="isCheckable"></a>QGroupBox::isCheckable () const
184</h3><p>Returns TRUE if the group box has a checkbox in its title; otherwise returns FALSE.
185See the <a href="qgroupbox.html#checkable-prop">"checkable"</a> property for details.
186<h3 class=fn>bool <a name="isChecked"></a>QGroupBox::isChecked () const
187</h3><p>Returns TRUE if the group box's checkbox is checked; otherwise returns FALSE.
188See the <a href="qgroupbox.html#checked-prop">"checked"</a> property for details.
189<h3 class=fn>bool <a name="isFlat"></a>QGroupBox::isFlat () const
190</h3><p>Returns TRUE if the group box is painted flat or has a frame; otherwise returns FALSE.
191See the <a href="qgroupbox.html#flat-prop">"flat"</a> property for details.
192<h3 class=fn><a href="qt.html#Orientation-enum">Orientation</a> <a name="orientation"></a>QGroupBox::orientation () const
193</h3><p>Returns the group box's orientation.
194See the <a href="qgroupbox.html#orientation-prop">"orientation"</a> property for details.
195<h3 class=fn>void <a name="setAlignment"></a>QGroupBox::setAlignment ( int )<tt> [virtual]</tt>
196</h3><p>Sets the alignment of the group box title.
197See the <a href="qgroupbox.html#alignment-prop">"alignment"</a> property for details.
198<h3 class=fn>void <a name="setCheckable"></a>QGroupBox::setCheckable ( bool&nbsp;b )
199</h3><p>Sets whether the group box has a checkbox in its title to <em>b</em>.
200See the <a href="qgroupbox.html#checkable-prop">"checkable"</a> property for details.
201<h3 class=fn>void <a name="setChecked"></a>QGroupBox::setChecked ( bool&nbsp;b )<tt> [slot]</tt>
202</h3><p>Sets whether the group box's checkbox is checked to <em>b</em>.
203See the <a href="qgroupbox.html#checked-prop">"checked"</a> property for details.
204<h3 class=fn>void <a name="setColumnLayout"></a>QGroupBox::setColumnLayout ( int&nbsp;strips, <a href="qt.html#Orientation-enum">Orientation</a>&nbsp;direction )<tt> [virtual]</tt>
205</h3>
206Changes the layout of the group box. This function is only useful
207in combination with the default constructor that does not take any
208layout information. This function will put all existing children
209in the new layout. It is not good Qt programming style to call
210this function after children have been inserted. Sets the number
211of columns or rows to be <em>strips</em>, depending on <em>direction</em>.
212<p> <p>See also <a href="#orientation-prop">orientation</a> and <a href="#columns-prop">columns</a>.
213
214<p>Example: <a href="tutorial2-09.html#x2641">chart/optionsform.cpp</a>.
215<h3 class=fn>void <a name="setColumns"></a>QGroupBox::setColumns ( int )
216</h3><p>Sets the number of columns or rows (depending on <a href="#orientation-prop">QGroupBox::orientation</a>) in the group box.
217See the <a href="qgroupbox.html#columns-prop">"columns"</a> property for details.
218<h3 class=fn>void <a name="setFlat"></a>QGroupBox::setFlat ( bool&nbsp;b )
219</h3><p>Sets whether the group box is painted flat or has a frame to <em>b</em>.
220See the <a href="qgroupbox.html#flat-prop">"flat"</a> property for details.
221<h3 class=fn>void <a name="setInsideMargin"></a>QGroupBox::setInsideMargin ( int&nbsp;m )
222</h3>
223Sets the the width of the inside margin to <em>m</em> pixels.
224<p> <p>See also <a href="#insideMargin">insideMargin</a>().
225
226<h3 class=fn>void <a name="setInsideSpacing"></a>QGroupBox::setInsideSpacing ( int&nbsp;s )
227</h3>
228Sets the width of the empty space between each of the items in
229the group to <em>s</em> pixels.
230<p> <p>See also <a href="#insideSpacing">insideSpacing</a>().
231
232<h3 class=fn>void <a name="setOrientation"></a>QGroupBox::setOrientation ( <a href="qt.html#Orientation-enum">Orientation</a> )
233</h3><p>Sets the group box's orientation.
234See the <a href="qgroupbox.html#orientation-prop">"orientation"</a> property for details.
235<h3 class=fn>void <a name="setTitle"></a>QGroupBox::setTitle ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp; )<tt> [virtual]</tt>
236</h3><p>Sets the group box title text.
237See the <a href="qgroupbox.html#title-prop">"title"</a> property for details.
238<h3 class=fn><a href="qstring.html">QString</a> <a name="title"></a>QGroupBox::title () const
239</h3><p>Returns the group box title text.
240See the <a href="qgroupbox.html#title-prop">"title"</a> property for details.
241<h3 class=fn>void <a name="toggled"></a>QGroupBox::toggled ( bool&nbsp;on )<tt> [signal]</tt>
242</h3>
243
244<p> If the group box has a check box (see <a href="#isCheckable">isCheckable</a>()) this signal
245is emitted when the check box is toggled. <em>on</em> is TRUE if the check
246box is checked; otherwise it is FALSE.
247
248<hr><h2>Property Documentation</h2>
249<h3 class=fn>Alignment <a name="alignment-prop"></a>alignment</h3>
250<p>This property holds the alignment of the group box title.
251<p>The title is always placed on the upper frame line. The horizontal
252alignment can be specified by the alignment parameter.
253<p> The alignment is one of the following flags:
254<ul>
255<li> <a href="qt.html#AlignmentFlags-enum">AlignAuto</a> aligns the title according to the language,
256usually to the left.
257<li> <a href="qt.html#AlignmentFlags-enum">AlignLeft</a> aligns the title text to the left.
258<li> <a href="qt.html#AlignmentFlags-enum">AlignRight</a> aligns the title text to the right.
259<li> <a href="qt.html#AlignmentFlags-enum">AlignHCenter</a> aligns the title text centered.
260</ul>
261<p> The default alignment is <a href="qt.html#AlignmentFlags-enum">AlignAuto</a>.
262<p> <p>See also <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a>.
263
264<p>Set this property's value with <a href="#setAlignment">setAlignment</a>() and get this property's value with <a href="#alignment">alignment</a>().
265<h3 class=fn>bool <a name="checkable-prop"></a>checkable</h3>
266<p>This property holds whether the group box has a checkbox in its title.
267<p>If this property is TRUE, the group box has a checkbox. If the
268checkbox is checked (which is the default), the group box's
269children are enabled.
270<p> <a href="#setCheckable">setCheckable</a>() controls whether or not the group box has a
271checkbox, and <a href="#isCheckable">isCheckable</a>() controls whether the checkbox is
272checked or not.
273
274<p>Set this property's value with <a href="#setCheckable">setCheckable</a>() and get this property's value with <a href="#isCheckable">isCheckable</a>().
275<h3 class=fn>bool <a name="checked-prop"></a>checked</h3>
276<p>This property holds whether the group box's checkbox is checked.
277<p>If the group box has a check box (see <a href="#isCheckable">isCheckable</a>()), and the
278check box is checked (see <a href="#isChecked">isChecked</a>()), the group box's children
279are enabled. If the checkbox is unchecked the children are
280disabled.
281
282<p>Set this property's value with <a href="#setChecked">setChecked</a>() and get this property's value with <a href="#isChecked">isChecked</a>().
283<h3 class=fn>int <a name="columns-prop"></a>columns</h3>
284<p>This property holds the number of columns or rows (depending on <a href="#orientation-prop">QGroupBox::orientation</a>) in the group box.
285<p>Usually it is not a good idea to set this property because it is
286slow (it does a complete layout). It is best to set the number
287of columns directly in the constructor.
288
289<p>Set this property's value with <a href="#setColumns">setColumns</a>() and get this property's value with <a href="#columns">columns</a>().
290<h3 class=fn>bool <a name="flat-prop"></a>flat</h3>
291<p>This property holds whether the group box is painted flat or has a frame.
292<p>By default a group box has a surrounding frame, with the title
293being placed on the upper frame line. In flat mode the right, left
294and bottom frame lines are omitted, and only the thin line at the
295top is drawn.
296<p> <p>See also <a href="#title-prop">title</a>.
297
298<p>Set this property's value with <a href="#setFlat">setFlat</a>() and get this property's value with <a href="#isFlat">isFlat</a>().
299<h3 class=fn><a href="qt.html#Orientation-enum">Orientation</a> <a name="orientation-prop"></a>orientation</h3>
300<p>This property holds the group box's orientation.
301<p>A horizontal group box arranges it's children in columns, while a
302vertical group box arranges them in rows.
303<p> Usually it is not a good idea to set this property because it is
304slow (it does a complete layout). It is better to set the
305orientation directly in the constructor.
306
307<p>Set this property's value with <a href="#setOrientation">setOrientation</a>() and get this property's value with <a href="#orientation">orientation</a>().
308<h3 class=fn><a href="qstring.html">QString</a> <a name="title-prop"></a>title</h3>
309<p>This property holds the group box title text.
310<p>The group box title text will have a focus-change keyboard
311accelerator if the title contains &amp;, followed by a letter.
312<p> <pre>
313 g-&gt;setTitle( "&amp;User information" );
314 </pre>
315
316This produces "<u>U</u>ser information"; Alt+U moves the <a href="focus.html#keyboard-focus">keyboard focus</a> to the group box.
317<p> There is no default title text.
318
319<p>Set this property's value with <a href="#setTitle">setTitle</a>() and get this property's value with <a href="#title">title</a>().
320<!-- eof -->
321<hr><p>
322This file is part of the <a href="index.html">Qt toolkit</a>.
323Copyright &copy; 1995-2007
324<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
325<table width=100% cellspacing=0 border=0><tr>
326<td>Copyright &copy; 2007
327<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
328<td align=right><div align=right>Qt 3.3.8</div>
329</table></div></address></body>
330</html>
Note: See TracBrowser for help on using the repository browser.