summaryrefslogtreecommitdiffstats
path: root/doc/man/man3/tqbuttongroup.3qt
blob: 2682f91a347ffc8fe1595f4c300721bff06edbb3 (plain)
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
'\" t
.TH QButtonGroup 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA.  All rights reserved.  See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QButtonGroup \- Organizes QButton widgets in a group
.SH SYNOPSIS
\fC#include <ntqbuttongroup.h>\fR
.PP
Inherits QGroupBox.
.PP
Inherited by QHButtonGroup and QVButtonGroup.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQButtonGroup\fR ( QWidget * parent = 0, const char * name = 0 )"
.br
.ti -1c
.BI "\fBQButtonGroup\fR ( const QString & title, QWidget * parent = 0, const char * name = 0 )"
.br
.ti -1c
.BI "\fBQButtonGroup\fR ( int strips, Orientation orientation, QWidget * parent = 0, const char * name = 0 )"
.br
.ti -1c
.BI "\fBQButtonGroup\fR ( int strips, Orientation orientation, const QString & title, QWidget * parent = 0, const char * name = 0 )"
.br
.ti -1c
.BI "bool \fBisExclusive\fR () const"
.br
.ti -1c
.BI "bool \fBisRadioButtonExclusive\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetExclusive\fR ( bool )"
.br
.ti -1c
.BI "virtual void \fBsetRadioButtonExclusive\fR ( bool )"
.br
.ti -1c
.BI "int \fBinsert\fR ( QButton * button, int id = -1 )"
.br
.ti -1c
.BI "void \fBremove\fR ( QButton * button )"
.br
.ti -1c
.BI "QButton * \fBfind\fR ( int id ) const"
.br
.ti -1c
.BI "int \fBid\fR ( QButton * button ) const"
.br
.ti -1c
.BI "int \fBcount\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetButton\fR ( int id )"
.br
.ti -1c
.BI "virtual void \fBmoveFocus\fR ( int key )"
.br
.ti -1c
.BI "QButton * \fBselected\fR () const"
.br
.ti -1c
.BI "int \fBselectedId\fR () const"
.br
.in -1c
.SS "Signals"
.in +1c
.ti -1c
.BI "void \fBpressed\fR ( int id )"
.br
.ti -1c
.BI "void \fBreleased\fR ( int id )"
.br
.ti -1c
.BI "void \fBclicked\fR ( int id )"
.br
.in -1c
.SS "Properties"
.in +1c
.ti -1c
.BI "bool \fBexclusive\fR - whether the button group is exclusive"
.br
.ti -1c
.BI "bool \fBradioButtonExclusive\fR - whether the radio buttons in the group are exclusive"
.br
.ti -1c
.BI "int \fBselectedId\fR - the selected toggle button"
.br
.in -1c
.SH DESCRIPTION
The QButtonGroup widget organizes QButton widgets in a group.
.PP
A button group widget makes it easier to deal with groups of buttons. Each button in a button group has a unique identifier. The button group emits a clicked() signal with this identifier when a button in the group is clicked. This makes a button group particularly useful when you have several similar buttons and want to connect all their clicked() signals to a single slot.
.PP
An exclusive button group switches off all toggle buttons except the one that was clicked. A button group is, by default, non-exclusive. Note that all radio buttons that are inserted into a button group are mutually exclusive even if the button group is non-exclusive. (See setRadioButtonExclusive().)
.PP
There are two ways of using a button group:
.TP
The button group is the parent widget of a number of buttons, i.e. the button group is the parent argument in the button constructor. The buttons are assigned identifiers 0, 1, 2, etc., in the order they are created. A QButtonGroup can display a frame and a title because it inherits QGroupBox.
.TP
The button group is an invisible widget and the contained buttons have some other parent widget. In this usage, each button must be manually inserted, using insert(), into the button group and given an identifier.
.PP
A button can be removed from the group with remove(). A pointer to a button with a given id can be obtained using find(). The id of a button is available using id(). A button can be set \fIon\fR with setButton(). The number of buttons in the group is returned by count().
.PP
.ce 1
.B "[Image Omitted]"
.PP

.ce 1
.B "[Image Omitted]"
.PP
See also QPushButton, QCheckBox, QRadioButton, Widget Appearance and Style, Layout Management, and Organizers.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QButtonGroup::QButtonGroup ( QWidget * parent = 0, const char * name = 0 )"
Constructs a button group with no title.
.PP
The \fIparent\fR and \fIname\fR arguments are passed to the QWidget constructor.
.SH "QButtonGroup::QButtonGroup ( const QString & title, QWidget * parent = 0, const char * name = 0 )"
Constructs a button group with the title \fItitle\fR.
.PP
The \fIparent\fR and \fIname\fR arguments are passed to the QWidget constructor.
.SH "QButtonGroup::QButtonGroup ( int strips, Orientation orientation, QWidget * parent = 0, const char * name = 0 )"
Constructs a button group with no title. Child widgets will be arranged in \fIstrips\fR rows or columns (depending on \fIorientation\fR).
.PP
The \fIparent\fR and \fIname\fR arguments are passed to the QWidget constructor.
.SH "QButtonGroup::QButtonGroup ( int strips, Orientation orientation, const QString & title, QWidget * parent = 0, const char * name = 0 )"
Constructs a button group with title \fItitle\fR. Child widgets will be arranged in \fIstrips\fR rows or columns (depending on \fIorientation\fR).
.PP
The \fIparent\fR and \fIname\fR arguments are passed to the QWidget constructor.
.SH "void QButtonGroup::clicked ( int id )\fC [signal]\fR"
This signal is emitted when a button in the group is clicked. The \fIid\fR argument is the button's identifier.
.PP
See also insert().
.PP
Examples:
.)l drawdemo/drawdemo.cpp and xform/xform.cpp.
.SH "int QButtonGroup::count () const"
Returns the number of buttons in the group.
.SH "QButton * QButtonGroup::find ( int id ) const"
Returns the button with the specified identifier \fIid\fR, or 0 if the button was not found.
.SH "int QButtonGroup::id ( QButton * button ) const"
Returns the id of \fIbutton\fR, or -1 if \fIbutton\fR is not a member of this group.
.PP
See also selectedId.
.SH "int QButtonGroup::insert ( QButton * button, int id = -1 )"
Inserts the \fIbutton\fR with the identifier \fIid\fR into the button group. Returns the button identifier.
.PP
Buttons are normally inserted into a button group automatically by passing the button group as the parent when the button is constructed. So it is not necessary to manually insert buttons that have this button group as their parent widget. An exception is when you want custom identifiers instead of the default 0, 1, 2, etc., or if you want the buttons to have some other parent.
.PP
The button is assigned the identifier \fIid\fR or an automatically generated identifier. It works as follows: If \fIid\fR >= 0, this identifier is assigned. If \fIid\fR == -1 (default), the identifier is equal to the number of buttons in the group. If \fIid\fR is any other negative integer, for instance -2, a unique identifier (negative integer <= -2) is generated. No button has an id of -1.
.PP
See also find(), remove(), and exclusive.
.PP
Examples:
.)l listbox/listbox.cpp and xform/xform.cpp.
.SH "bool QButtonGroup::isExclusive () const"
Returns TRUE if the button group is exclusive; otherwise returns FALSE. See the "exclusive" property for details.
.SH "bool QButtonGroup::isRadioButtonExclusive () const"
Returns TRUE if the radio buttons in the group are exclusive; otherwise returns FALSE. See the "radioButtonExclusive" property for details.
.SH "void QButtonGroup::moveFocus ( int key )\fC [virtual]\fR"
Moves the keyboard focus according to \fIkey\fR, and if appropriate checks the new focus item.
.PP
This function does nothing unless the keyboard focus points to one of the button group members and \fIkey\fR is one of Key_Up, Key_Down, Key_Left and Key_Right.
.SH "void QButtonGroup::pressed ( int id )\fC [signal]\fR"
This signal is emitted when a button in the group is pressed. The \fIid\fR argument is the button's identifier.
.PP
See also insert().
.SH "void QButtonGroup::released ( int id )\fC [signal]\fR"
This signal is emitted when a button in the group is released. The \fIid\fR argument is the button's identifier.
.PP
See also insert().
.SH "void QButtonGroup::remove ( QButton * button )"
Removes the \fIbutton\fR from the button group.
.PP
See also insert().
.SH "QButton * QButtonGroup::selected () const"
Returns the selected toggle button if exactly one is selected; otherwise returns 0.
.PP
See also selectedId.
.SH "int QButtonGroup::selectedId () const"
Returns the selected toggle button. See the "selectedId" property for details.
.SH "void QButtonGroup::setButton ( int id )\fC [virtual]\fR"
Sets the selected toggle button to \fIid\fR. See the "selectedId" property for details.
.SH "void QButtonGroup::setExclusive ( bool )\fC [virtual]\fR"
Sets whether the button group is exclusive. See the "exclusive" property for details.
.SH "void QButtonGroup::setRadioButtonExclusive ( bool )\fC [virtual]\fR"
Sets whether the radio buttons in the group are exclusive. See the "radioButtonExclusive" property for details.
.SS "Property Documentation"
.SH "bool exclusive"
This property holds whether the button group is exclusive.
.PP
If this property is TRUE, then the buttons in the group are toggled, and to untoggle a button you must click on another button in the group. The default value is FALSE.
.PP
Set this property's value with setExclusive() and get this property's value with isExclusive().
.SH "bool radioButtonExclusive"
This property holds whether the radio buttons in the group are exclusive.
.PP
If this property is TRUE (the default), the radiobuttons in the group are treated exclusively.
.PP
Set this property's value with setRadioButtonExclusive() and get this property's value with isRadioButtonExclusive().
.SH "int selectedId"
This property holds the selected toggle button.
.PP
The toggle button is specified as an ID.
.PP
If no toggle button is selected, this property holds -1.
.PP
If setButton() is called on an exclusive group, the button with the given id will be set to on and all the others will be set to off.
.PP
See also selected().
.PP
Set this property's value with setButton() and get this property's value with selectedId().

.SH "SEE ALSO"
.BR http://doc.trolltech.com/ntqbuttongroup.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive TQt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using TQt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech. 
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (tqbuttongroup.3qt) and the Qt
version (3.3.8).