You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qt3/doc/html/qgroupbox.html

331 lines
20 KiB

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qgroupbox.cpp:56 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QGroupBox Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<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>
<p>The QGroupBox widget provides a group box frame with a title.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qgroupbox-h.html">qgroupbox.h</a>&gt;</tt>
<p>Inherits <a href="qframe.html">QFrame</a>.
<p>Inherited by <a href="qbuttongroup.html">QButtonGroup</a>, <a href="qhgroupbox.html">QHGroupBox</a>, and <a href="qvgroupbox.html">QVGroupBox</a>.
<p><a href="qgroupbox-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#QGroupBox"><b>QGroupBox</b></a> ( QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<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>
<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>
<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>
<li class=fn><a href="#~QGroupBox"><b>~QGroupBox</b></a> ()</li>
<li class=fn>virtual void <a href="#setColumnLayout"><b>setColumnLayout</b></a> ( int&nbsp;strips, Orientation&nbsp;direction )</li>
<li class=fn>QString <a href="#title"><b>title</b></a> () const</li>
<li class=fn>virtual void <a href="#setTitle"><b>setTitle</b></a> ( const QString &amp; )</li>
<li class=fn>int <a href="#alignment"><b>alignment</b></a> () const</li>
<li class=fn>virtual void <a href="#setAlignment"><b>setAlignment</b></a> ( int )</li>
<li class=fn>int <a href="#columns"><b>columns</b></a> () const</li>
<li class=fn>void <a href="#setColumns"><b>setColumns</b></a> ( int )</li>
<li class=fn>Orientation <a href="#orientation"><b>orientation</b></a> () const</li>
<li class=fn>void <a href="#setOrientation"><b>setOrientation</b></a> ( Orientation )</li>
<li class=fn>int <a href="#insideMargin"><b>insideMargin</b></a> () const</li>
<li class=fn>int <a href="#insideSpacing"><b>insideSpacing</b></a> () const</li>
<li class=fn>void <a href="#setInsideMargin"><b>setInsideMargin</b></a> ( int&nbsp;m )</li>
<li class=fn>void <a href="#setInsideSpacing"><b>setInsideSpacing</b></a> ( int&nbsp;s )</li>
<li class=fn>void <a href="#addSpace"><b>addSpace</b></a> ( int&nbsp;size )</li>
<li class=fn>bool <a href="#isFlat"><b>isFlat</b></a> () const</li>
<li class=fn>void <a href="#setFlat"><b>setFlat</b></a> ( bool&nbsp;b )</li>
<li class=fn>bool <a href="#isCheckable"><b>isCheckable</b></a> () const</li>
<li class=fn>void <a href="#setCheckable"><b>setCheckable</b></a> ( bool&nbsp;b )</li>
<li class=fn>bool <a href="#isChecked"><b>isChecked</b></a> () const</li>
</ul>
<h2>Public Slots</h2>
<ul>
<li class=fn>void <a href="#setChecked"><b>setChecked</b></a> ( bool&nbsp;b )</li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#toggled"><b>toggled</b></a> ( bool&nbsp;on )</li>
</ul>
<h2>Properties</h2>
<ul>
<li class=fn>Alignment <a href="#alignment-prop"><b>alignment</b></a>&nbsp;- the alignment of the group box title</li>
<li class=fn>bool <a href="#checkable-prop"><b>checkable</b></a>&nbsp;- whether the group box has a checkbox in its title</li>
<li class=fn>bool <a href="#checked-prop"><b>checked</b></a>&nbsp;- whether the group box's checkbox is checked</li>
<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>
<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>
<li class=fn>Orientation <a href="#orientation-prop"><b>orientation</b></a>&nbsp;- the group box's orientation</li>
<li class=fn>QString <a href="#title-prop"><b>title</b></a>&nbsp;- the group box title text</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
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 <a href="focus.html#keyboard-focus">keyboard focus</a> to one of the group
box's child widgets, and the child widgets are usually laid out
horizontally (or vertically) inside the frame.
<p> The simplest way to use it is to create a group box with the
desired number of columns (or rows) and orientation, and then just
create widgets with the group box as parent.
<p> It is also possible to change the <a href="#orientation">orientation</a>() and number of
<a href="#columns">columns</a>() after construction, or to ignore all the automatic
layout support and manage the layout yourself. You can add 'empty'
spaces to the group box with <a href="#addSpace">addSpace</a>().
<p> QGroupBox also lets you set the <a href="#title">title</a>() (normally set in the
constructor) and the title's <a href="#alignment">alignment</a>().
<p> You can change the spacing used by the group box with
<a href="#setInsideMargin">setInsideMargin</a>() and <a href="#setInsideSpacing">setInsideSpacing</a>(). To minimize space
consumption, you can remove the right, left and bottom edges of
the frame with <a href="#setFlat">setFlat</a>().
<p> <img src=qgrpbox-w.png>
<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>.
<hr><h2>Member Function Documentation</h2>
<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 )
</h3>
Constructs a group box widget with no title.
<p> The <em>parent</em> and <em>name</em> arguments are passed to the <a href="qwidget.html">QWidget</a>
constructor.
<p> This constructor does not do automatic layout.
<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 )
</h3>
Constructs a group box with the title <em>title</em>.
<p> The <em>parent</em> and <em>name</em> arguments are passed to the <a href="qwidget.html">QWidget</a>
constructor.
<p> This constructor does not do automatic layout.
<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 )
</h3>
Constructs a group box with no title. Child widgets will be
arranged in <em>strips</em> rows or columns (depending on <em>orientation</em>).
<p> The <em>parent</em> and <em>name</em> arguments are passed to the <a href="qwidget.html">QWidget</a>
constructor.
<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 )
</h3>
Constructs a group box titled <em>title</em>. Child widgets will be
arranged in <em>strips</em> rows or columns (depending on <em>orientation</em>).
<p> The <em>parent</em> and <em>name</em> arguments are passed to the <a href="qwidget.html">QWidget</a>
constructor.
<h3 class=fn><a name="~QGroupBox"></a>QGroupBox::~QGroupBox ()
</h3>
Destroys the group box.
<h3 class=fn>void <a name="addSpace"></a>QGroupBox::addSpace ( int&nbsp;size )
</h3>
Adds an empty cell at the next free position. If <em>size</em> is
greater than 0, the empty cell takes <em>size</em> to be its fixed width
(if <a href="#orientation">orientation</a>() is <a href="qt.html#Orientation-enum">Horizontal</a>) or height (if orientation() is
<a href="qt.html#Orientation-enum">Vertical</a>).
<p> Use this method to separate the widgets in the group box or to
skip the next free cell. For performance reasons, call this method
after 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
generally a good idea to call these methods first (if needed at
all), and insert the widgets and spaces afterwards.
<h3 class=fn>int <a name="alignment"></a>QGroupBox::alignment () const
</h3><p>Returns the alignment of the group box title.
See the <a href="qgroupbox.html#alignment-prop">"alignment"</a> property for details.
<h3 class=fn>int <a name="columns"></a>QGroupBox::columns () const
</h3><p>Returns the number of columns or rows (depending on <a href="#orientation-prop">QGroupBox::orientation</a>) in the group box.
See the <a href="qgroupbox.html#columns-prop">"columns"</a> property for details.
<h3 class=fn>int <a name="insideMargin"></a>QGroupBox::insideMargin () const
</h3>
Returns the width of the empty space between the items in the
group and the frame of the group.
<p> Only applies if the group box has a defined orientation.
<p> The default is usually 11, by may vary depending on the platform
and style.
<p> <p>See also <a href="#setInsideMargin">setInsideMargin</a>() and <a href="#orientation-prop">orientation</a>.
<h3 class=fn>int <a name="insideSpacing"></a>QGroupBox::insideSpacing () const
</h3>
Returns the width of the empty space between each of the items
in the group.
<p> Only applies if the group box has a defined orientation.
<p> The default is usually 5, by may vary depending on the platform
and style.
<p> <p>See also <a href="#setInsideSpacing">setInsideSpacing</a>() and <a href="#orientation-prop">orientation</a>.
<h3 class=fn>bool <a name="isCheckable"></a>QGroupBox::isCheckable () const
</h3><p>Returns TRUE if the group box has a checkbox in its title; otherwise returns FALSE.
See the <a href="qgroupbox.html#checkable-prop">"checkable"</a> property for details.
<h3 class=fn>bool <a name="isChecked"></a>QGroupBox::isChecked () const
</h3><p>Returns TRUE if the group box's checkbox is checked; otherwise returns FALSE.
See the <a href="qgroupbox.html#checked-prop">"checked"</a> property for details.
<h3 class=fn>bool <a name="isFlat"></a>QGroupBox::isFlat () const
</h3><p>Returns TRUE if the group box is painted flat or has a frame; otherwise returns FALSE.
See the <a href="qgroupbox.html#flat-prop">"flat"</a> property for details.
<h3 class=fn><a href="qt.html#Orientation-enum">Orientation</a> <a name="orientation"></a>QGroupBox::orientation () const
</h3><p>Returns the group box's orientation.
See the <a href="qgroupbox.html#orientation-prop">"orientation"</a> property for details.
<h3 class=fn>void <a name="setAlignment"></a>QGroupBox::setAlignment ( int )<tt> [virtual]</tt>
</h3><p>Sets the alignment of the group box title.
See the <a href="qgroupbox.html#alignment-prop">"alignment"</a> property for details.
<h3 class=fn>void <a name="setCheckable"></a>QGroupBox::setCheckable ( bool&nbsp;b )
</h3><p>Sets whether the group box has a checkbox in its title to <em>b</em>.
See the <a href="qgroupbox.html#checkable-prop">"checkable"</a> property for details.
<h3 class=fn>void <a name="setChecked"></a>QGroupBox::setChecked ( bool&nbsp;b )<tt> [slot]</tt>
</h3><p>Sets whether the group box's checkbox is checked to <em>b</em>.
See the <a href="qgroupbox.html#checked-prop">"checked"</a> property for details.
<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>
</h3>
Changes the layout of the group box. This function is only useful
in combination with the default constructor that does not take any
layout information. This function will put all existing children
in the new layout. It is not good Qt programming style to call
this function after children have been inserted. Sets the number
of columns or rows to be <em>strips</em>, depending on <em>direction</em>.
<p> <p>See also <a href="#orientation-prop">orientation</a> and <a href="#columns-prop">columns</a>.
<p>Example: <a href="tutorial2-09.html#x2641">chart/optionsform.cpp</a>.
<h3 class=fn>void <a name="setColumns"></a>QGroupBox::setColumns ( int )
</h3><p>Sets the number of columns or rows (depending on <a href="#orientation-prop">QGroupBox::orientation</a>) in the group box.
See the <a href="qgroupbox.html#columns-prop">"columns"</a> property for details.
<h3 class=fn>void <a name="setFlat"></a>QGroupBox::setFlat ( bool&nbsp;b )
</h3><p>Sets whether the group box is painted flat or has a frame to <em>b</em>.
See the <a href="qgroupbox.html#flat-prop">"flat"</a> property for details.
<h3 class=fn>void <a name="setInsideMargin"></a>QGroupBox::setInsideMargin ( int&nbsp;m )
</h3>
Sets the the width of the inside margin to <em>m</em> pixels.
<p> <p>See also <a href="#insideMargin">insideMargin</a>().
<h3 class=fn>void <a name="setInsideSpacing"></a>QGroupBox::setInsideSpacing ( int&nbsp;s )
</h3>
Sets the width of the empty space between each of the items in
the group to <em>s</em> pixels.
<p> <p>See also <a href="#insideSpacing">insideSpacing</a>().
<h3 class=fn>void <a name="setOrientation"></a>QGroupBox::setOrientation ( <a href="qt.html#Orientation-enum">Orientation</a> )
</h3><p>Sets the group box's orientation.
See the <a href="qgroupbox.html#orientation-prop">"orientation"</a> property for details.
<h3 class=fn>void <a name="setTitle"></a>QGroupBox::setTitle ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp; )<tt> [virtual]</tt>
</h3><p>Sets the group box title text.
See the <a href="qgroupbox.html#title-prop">"title"</a> property for details.
<h3 class=fn><a href="qstring.html">QString</a> <a name="title"></a>QGroupBox::title () const
</h3><p>Returns the group box title text.
See the <a href="qgroupbox.html#title-prop">"title"</a> property for details.
<h3 class=fn>void <a name="toggled"></a>QGroupBox::toggled ( bool&nbsp;on )<tt> [signal]</tt>
</h3>
<p> If the group box has a check box (see <a href="#isCheckable">isCheckable</a>()) this signal
is emitted when the check box is toggled. <em>on</em> is TRUE if the check
box is checked; otherwise it is FALSE.
<hr><h2>Property Documentation</h2>
<h3 class=fn>Alignment <a name="alignment-prop"></a>alignment</h3>
<p>This property holds the alignment of the group box title.
<p>The title is always placed on the upper frame line. The horizontal
alignment can be specified by the alignment parameter.
<p> The alignment is one of the following flags:
<ul>
<li> <a href="qt.html#AlignmentFlags-enum">AlignAuto</a> aligns the title according to the language,
usually to the left.
<li> <a href="qt.html#AlignmentFlags-enum">AlignLeft</a> aligns the title text to the left.
<li> <a href="qt.html#AlignmentFlags-enum">AlignRight</a> aligns the title text to the right.
<li> <a href="qt.html#AlignmentFlags-enum">AlignHCenter</a> aligns the title text centered.
</ul>
<p> The default alignment is <a href="qt.html#AlignmentFlags-enum">AlignAuto</a>.
<p> <p>See also <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a>.
<p>Set this property's value with <a href="#setAlignment">setAlignment</a>() and get this property's value with <a href="#alignment">alignment</a>().
<h3 class=fn>bool <a name="checkable-prop"></a>checkable</h3>
<p>This property holds whether the group box has a checkbox in its title.
<p>If this property is TRUE, the group box has a checkbox. If the
checkbox is checked (which is the default), the group box's
children are enabled.
<p> <a href="#setCheckable">setCheckable</a>() controls whether or not the group box has a
checkbox, and <a href="#isCheckable">isCheckable</a>() controls whether the checkbox is
checked or not.
<p>Set this property's value with <a href="#setCheckable">setCheckable</a>() and get this property's value with <a href="#isCheckable">isCheckable</a>().
<h3 class=fn>bool <a name="checked-prop"></a>checked</h3>
<p>This property holds whether the group box's checkbox is checked.
<p>If the group box has a check box (see <a href="#isCheckable">isCheckable</a>()), and the
check box is checked (see <a href="#isChecked">isChecked</a>()), the group box's children
are enabled. If the checkbox is unchecked the children are
disabled.
<p>Set this property's value with <a href="#setChecked">setChecked</a>() and get this property's value with <a href="#isChecked">isChecked</a>().
<h3 class=fn>int <a name="columns-prop"></a>columns</h3>
<p>This property holds the number of columns or rows (depending on <a href="#orientation-prop">QGroupBox::orientation</a>) in the group box.
<p>Usually it is not a good idea to set this property because it is
slow (it does a complete layout). It is best to set the number
of columns directly in the constructor.
<p>Set this property's value with <a href="#setColumns">setColumns</a>() and get this property's value with <a href="#columns">columns</a>().
<h3 class=fn>bool <a name="flat-prop"></a>flat</h3>
<p>This property holds whether the group box is painted flat or has a frame.
<p>By default a group box has a surrounding frame, with the title
being placed on the upper frame line. In flat mode the right, left
and bottom frame lines are omitted, and only the thin line at the
top is drawn.
<p> <p>See also <a href="#title-prop">title</a>.
<p>Set this property's value with <a href="#setFlat">setFlat</a>() and get this property's value with <a href="#isFlat">isFlat</a>().
<h3 class=fn><a href="qt.html#Orientation-enum">Orientation</a> <a name="orientation-prop"></a>orientation</h3>
<p>This property holds the group box's orientation.
<p>A horizontal group box arranges it's children in columns, while a
vertical group box arranges them in rows.
<p> Usually it is not a good idea to set this property because it is
slow (it does a complete layout). It is better to set the
orientation directly in the constructor.
<p>Set this property's value with <a href="#setOrientation">setOrientation</a>() and get this property's value with <a href="#orientation">orientation</a>().
<h3 class=fn><a href="qstring.html">QString</a> <a name="title-prop"></a>title</h3>
<p>This property holds the group box title text.
<p>The group box title text will have a focus-change keyboard
accelerator if the title contains &amp;, followed by a letter.
<p> <pre>
g-&gt;setTitle( "&amp;User information" );
</pre>
This produces "<u>U</u>ser information"; Alt+U moves the <a href="focus.html#keyboard-focus">keyboard focus</a> to the group box.
<p> There is no default title text.
<p>Set this property's value with <a href="#setTitle">setTitle</a>() and get this property's value with <a href="#title">title</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>