source: trunk/doc/html/qbuttongroup.html

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

reference documentation added

File size: 15.9 KB
RevLine 
[190]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/qbuttongroup.cpp:47 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QButtonGroup 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>QButtonGroup Class Reference</h1>
33
34<p>The QButtonGroup widget organizes QButton widgets in a group.
35<a href="#details">More...</a>
36<p><tt>#include &lt;<a href="qbuttongroup-h.html">qbuttongroup.h</a>&gt;</tt>
37<p>Inherits <a href="qgroupbox.html">QGroupBox</a>.
38<p>Inherited by <a href="qhbuttongroup.html">QHButtonGroup</a> and <a href="qvbuttongroup.html">QVButtonGroup</a>.
39<p><a href="qbuttongroup-members.html">List of all member functions.</a>
40<h2>Public Members</h2>
41<ul>
42<li class=fn><a href="#QButtonGroup"><b>QButtonGroup</b></a> ( QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
43<li class=fn><a href="#QButtonGroup-2"><b>QButtonGroup</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="#QButtonGroup-3"><b>QButtonGroup</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="#QButtonGroup-4"><b>QButtonGroup</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>bool <a href="#isExclusive"><b>isExclusive</b></a> () const</li>
47<li class=fn>bool <a href="#isRadioButtonExclusive"><b>isRadioButtonExclusive</b></a> () const</li>
48<li class=fn>virtual void <a href="#setExclusive"><b>setExclusive</b></a> ( bool )</li>
49<li class=fn>virtual void <a href="#setRadioButtonExclusive"><b>setRadioButtonExclusive</b></a> ( bool )</li>
50<li class=fn>int <a href="#insert"><b>insert</b></a> ( QButton&nbsp;*&nbsp;button, int&nbsp;id = -1 )</li>
51<li class=fn>void <a href="#remove"><b>remove</b></a> ( QButton&nbsp;*&nbsp;button )</li>
52<li class=fn>QButton * <a href="#find"><b>find</b></a> ( int&nbsp;id ) const</li>
53<li class=fn>int <a href="#id"><b>id</b></a> ( QButton&nbsp;*&nbsp;button ) const</li>
54<li class=fn>int <a href="#count"><b>count</b></a> () const</li>
55<li class=fn>virtual void <a href="#setButton"><b>setButton</b></a> ( int&nbsp;id )</li>
56<li class=fn>virtual void <a href="#moveFocus"><b>moveFocus</b></a> ( int&nbsp;key )</li>
57<li class=fn>QButton * <a href="#selected"><b>selected</b></a> () const</li>
58<li class=fn>int <a href="#selectedId"><b>selectedId</b></a> () const</li>
59</ul>
60<h2>Signals</h2>
61<ul>
62<li class=fn>void <a href="#pressed"><b>pressed</b></a> ( int&nbsp;id )</li>
63<li class=fn>void <a href="#released"><b>released</b></a> ( int&nbsp;id )</li>
64<li class=fn>void <a href="#clicked"><b>clicked</b></a> ( int&nbsp;id )</li>
65</ul>
66<h2>Properties</h2>
67<ul>
68<li class=fn>bool <a href="#exclusive-prop"><b>exclusive</b></a>&nbsp;- whether the button group is exclusive</li>
69<li class=fn>bool <a href="#radioButtonExclusive-prop"><b>radioButtonExclusive</b></a>&nbsp;- whether the radio buttons in the group are exclusive</li>
70<li class=fn>int <a href="#selectedId-prop"><b>selectedId</b></a>&nbsp;- the selected toggle button</li>
71</ul>
72<hr><a name="details"></a><h2>Detailed Description</h2>
73
74
75The QButtonGroup widget organizes <a href="qbutton.html">QButton</a> widgets in a group.
76<p>
77
78
79
80<p> A button group widget makes it easier to deal with groups of
81buttons. Each button in a button group has a unique identifier.
82The button group emits a <a href="#clicked">clicked</a>() signal with this identifier
83when a button in the group is clicked. This makes a button group
84particularly useful when you have several similar buttons and want
85to connect all their clicked() signals to a single slot.
86<p> An <a href="#setExclusive">exclusive</a> button group switches
87off all toggle buttons except the one that was clicked. A button
88group is, by default, non-exclusive. Note that all radio buttons
89that are inserted into a button group are mutually exclusive even
90if the button group is non-exclusive. (See
91<a href="#setRadioButtonExclusive">setRadioButtonExclusive</a>().)
92<p> There are two ways of using a button group:
93<ul>
94<li> The button group is the parent widget of a number of buttons,
95i.e. the button group is the parent argument in the button
96constructor. The buttons are assigned identifiers 0, 1, 2, etc.,
97in the order they are created. A QButtonGroup can display a frame
98and a title because it inherits <a href="qgroupbox.html">QGroupBox</a>.
99<li> The button group is an invisible widget and the contained
100buttons have some other parent widget. In this usage, each button
101must be manually inserted, using <a href="#insert">insert</a>(), into the button group
102and given an identifier.
103</ul>
104<p> A button can be removed from the group with <a href="#remove">remove</a>(). A pointer to
105a button with a given id can be obtained using <a href="#find">find</a>(). The id of a
106button is available using <a href="#id">id</a>(). A button can be set <em>on</em> with
107<a href="#setButton">setButton</a>(). The number of buttons in the group is returned by
108<a href="#count">count</a>().
109<p> <img src=qbttngrp-m.png> <img src=qbttngrp-w.png>
110<p> <p>See also <a href="qpushbutton.html">QPushButton</a>, <a href="qcheckbox.html">QCheckBox</a>, <a href="qradiobutton.html">QRadioButton</a>, <a href="appearance.html">Widget Appearance and Style</a>, <a href="geomanagement.html">Layout Management</a>, and <a href="organizers.html">Organizers</a>.
111
112<hr><h2>Member Function Documentation</h2>
113<h3 class=fn><a name="QButtonGroup"></a>QButtonGroup::QButtonGroup ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
114</h3>
115Constructs a button group with no title.
116<p> The <em>parent</em> and <em>name</em> arguments are passed to the <a href="qwidget.html">QWidget</a>
117constructor.
118
119<h3 class=fn><a name="QButtonGroup-2"></a>QButtonGroup::QButtonGroup ( 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 )
120</h3>
121Constructs a button group with the title <em>title</em>.
122<p> The <em>parent</em> and <em>name</em> arguments are passed to the <a href="qwidget.html">QWidget</a>
123constructor.
124
125<h3 class=fn><a name="QButtonGroup-3"></a>QButtonGroup::QButtonGroup ( 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 )
126</h3>
127Constructs a button group with no title. Child widgets will be
128arranged in <em>strips</em> rows or columns (depending on <em>orientation</em>).
129<p> The <em>parent</em> and <em>name</em> arguments are passed to the <a href="qwidget.html">QWidget</a>
130constructor.
131
132<h3 class=fn><a name="QButtonGroup-4"></a>QButtonGroup::QButtonGroup ( 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 )
133</h3>
134Constructs a button group with title <em>title</em>. Child widgets will
135be arranged in <em>strips</em> rows or columns (depending on <em>orientation</em>).
136<p> The <em>parent</em> and <em>name</em> arguments are passed to the <a href="qwidget.html">QWidget</a>
137constructor.
138
139<h3 class=fn>void <a name="clicked"></a>QButtonGroup::clicked ( int&nbsp;id )<tt> [signal]</tt>
140</h3>
141
142<p> This signal is emitted when a button in the group is <a href="qbutton.html#clicked">clicked</a>. The <em>id</em> argument is the
143button's identifier.
144<p> <p>See also <a href="#insert">insert</a>().
145
146<p>Examples: <a href="drawdemo-example.html#x1062">drawdemo/drawdemo.cpp</a> and <a href="xform-example.html#x1221">xform/xform.cpp</a>.
147<h3 class=fn>int <a name="count"></a>QButtonGroup::count () const
148</h3>
149Returns the number of buttons in the group.
150
151<h3 class=fn><a href="qbutton.html">QButton</a>&nbsp;* <a name="find"></a>QButtonGroup::find ( int&nbsp;id ) const
152</h3>
153Returns the button with the specified identifier <em>id</em>, or 0 if
154the button was not found.
155
156<h3 class=fn>int <a name="id"></a>QButtonGroup::id ( <a href="qbutton.html">QButton</a>&nbsp;*&nbsp;button ) const
157</h3>
158Returns the id of <em>button</em>, or -1 if <em>button</em> is not a member of
159this group.
160<p> <p>See also <a href="#selectedId-prop">selectedId</a>.
161
162<h3 class=fn>int <a name="insert"></a>QButtonGroup::insert ( <a href="qbutton.html">QButton</a>&nbsp;*&nbsp;button, int&nbsp;id = -1 )
163</h3>
164Inserts the <em>button</em> with the identifier <em>id</em> into the button
165group. Returns the button identifier.
166<p> Buttons are normally inserted into a button group automatically by
167passing the button group as the parent when the button is
168constructed. So it is not necessary to manually insert buttons
169that have this button group as their parent widget. An exception
170is when you want custom identifiers instead of the default 0, 1,
1712, etc., or if you want the buttons to have some other parent.
172<p> The button is assigned the identifier <em>id</em> or an automatically
173generated identifier. It works as follows: If <em>id</em> >= 0, this
174identifier is assigned. If <em>id</em> == -1 (default), the identifier
175is equal to the number of buttons in the group. If <em>id</em> is any
176other negative integer, for instance -2, a unique identifier
177(negative integer &lt;= -2) is generated. No button has an id of -1.
178<p> <p>See also <a href="#find">find</a>(), <a href="#remove">remove</a>(), and <a href="#exclusive-prop">exclusive</a>.
179
180<p>Examples: <a href="listbox-example.html#x1428">listbox/listbox.cpp</a> and <a href="xform-example.html#x1222">xform/xform.cpp</a>.
181<h3 class=fn>bool <a name="isExclusive"></a>QButtonGroup::isExclusive () const
182</h3><p>Returns TRUE if the button group is exclusive; otherwise returns FALSE.
183See the <a href="qbuttongroup.html#exclusive-prop">"exclusive"</a> property for details.
184<h3 class=fn>bool <a name="isRadioButtonExclusive"></a>QButtonGroup::isRadioButtonExclusive () const
185</h3><p>Returns TRUE if the radio buttons in the group are exclusive; otherwise returns FALSE.
186See the <a href="qbuttongroup.html#radioButtonExclusive-prop">"radioButtonExclusive"</a> property for details.
187<h3 class=fn>void <a name="moveFocus"></a>QButtonGroup::moveFocus ( int&nbsp;key )<tt> [virtual]</tt>
188</h3>
189Moves the <a href="focus.html#keyboard-focus">keyboard focus</a> according to <em>key</em>, and if appropriate
190checks the new focus item.
191<p> This function does nothing unless the keyboard focus points to one
192of the button group members and <em>key</em> is one of <a href="qt.html#Key-enum">Key_Up</a>, <a href="qt.html#Key-enum">Key_Down</a>, <a href="qt.html#Key-enum">Key_Left</a> and <a href="qt.html#Key-enum">Key_Right</a>.
193
194<h3 class=fn>void <a name="pressed"></a>QButtonGroup::pressed ( int&nbsp;id )<tt> [signal]</tt>
195</h3>
196
197<p> This signal is emitted when a button in the group is <a href="qbutton.html#pressed">pressed</a>. The <em>id</em> argument is the
198button's identifier.
199<p> <p>See also <a href="#insert">insert</a>().
200
201<h3 class=fn>void <a name="released"></a>QButtonGroup::released ( int&nbsp;id )<tt> [signal]</tt>
202</h3>
203
204<p> This signal is emitted when a button in the group is <a href="qbutton.html#released">released</a>. The <em>id</em> argument is the
205button's identifier.
206<p> <p>See also <a href="#insert">insert</a>().
207
208<h3 class=fn>void <a name="remove"></a>QButtonGroup::remove ( <a href="qbutton.html">QButton</a>&nbsp;*&nbsp;button )
209</h3>
210Removes the <em>button</em> from the button group.
211<p> <p>See also <a href="#insert">insert</a>().
212
213<h3 class=fn><a href="qbutton.html">QButton</a>&nbsp;* <a name="selected"></a>QButtonGroup::selected () const
214</h3>
215Returns the selected toggle button if exactly one is selected;
216otherwise returns 0.
217<p> <p>See also <a href="#selectedId-prop">selectedId</a>.
218
219<h3 class=fn>int <a name="selectedId"></a>QButtonGroup::selectedId () const
220</h3><p>Returns the selected toggle button.
221See the <a href="qbuttongroup.html#selectedId-prop">"selectedId"</a> property for details.
222<h3 class=fn>void <a name="setButton"></a>QButtonGroup::setButton ( int&nbsp;id )<tt> [virtual]</tt>
223</h3><p>Sets the selected toggle button to <em>id</em>.
224See the <a href="qbuttongroup.html#selectedId-prop">"selectedId"</a> property for details.
225<h3 class=fn>void <a name="setExclusive"></a>QButtonGroup::setExclusive ( bool )<tt> [virtual]</tt>
226</h3><p>Sets whether the button group is exclusive.
227See the <a href="qbuttongroup.html#exclusive-prop">"exclusive"</a> property for details.
228<h3 class=fn>void <a name="setRadioButtonExclusive"></a>QButtonGroup::setRadioButtonExclusive ( bool )<tt> [virtual]</tt>
229</h3><p>Sets whether the radio buttons in the group are exclusive.
230See the <a href="qbuttongroup.html#radioButtonExclusive-prop">"radioButtonExclusive"</a> property for details.
231<hr><h2>Property Documentation</h2>
232<h3 class=fn>bool <a name="exclusive-prop"></a>exclusive</h3>
233<p>This property holds whether the button group is exclusive.
234<p>If this property is TRUE, then the buttons in the group are
235toggled, and to untoggle a button you must click on another button
236in the group. The default value is FALSE.
237
238<p>Set this property's value with <a href="#setExclusive">setExclusive</a>() and get this property's value with <a href="#isExclusive">isExclusive</a>().
239<h3 class=fn>bool <a name="radioButtonExclusive-prop"></a>radioButtonExclusive</h3>
240<p>This property holds whether the radio buttons in the group are exclusive.
241<p>If this property is TRUE (the default), the <a href="qradiobutton.html">radiobuttons</a> in the group are treated exclusively.
242
243<p>Set this property's value with <a href="#setRadioButtonExclusive">setRadioButtonExclusive</a>() and get this property's value with <a href="#isRadioButtonExclusive">isRadioButtonExclusive</a>().
244<h3 class=fn>int <a name="selectedId-prop"></a>selectedId</h3>
245<p>This property holds the selected toggle button.
246<p>The toggle button is specified as an ID.
247<p> If no toggle button is selected, this property holds -1.
248<p> If <a href="#setButton">setButton</a>() is called on an exclusive group, the button with
249the given id will be set to on and all the others will be set to
250off.
251<p> <p>See also <a href="#selected">selected</a>().
252
253<p>Set this property's value with <a href="#setButton">setButton</a>() and get this property's value with <a href="#selectedId">selectedId</a>().
254<!-- eof -->
255<hr><p>
256This file is part of the <a href="index.html">Qt toolkit</a>.
257Copyright &copy; 1995-2007
258<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
259<table width=100% cellspacing=0 border=0><tr>
260<td>Copyright &copy; 2007
261<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
262<td align=right><div align=right>Qt 3.3.8</div>
263</table></div></address></body>
264</html>
Note: See TracBrowser for help on using the repository browser.