summaryrefslogtreecommitdiffstats
path: root/doc/html/qchecklistitem.html
blob: e00e24e33506ef61a21b2bfbe0c85367eeb0f519 (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
244
245
246
247
248
249
250
251
252
253
254
255
256
<!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/qlistview.cpp:5987 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QCheckListItem 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>QCheckListItem Class Reference</h1>

<p>The QCheckListItem class provides checkable list view items.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qlistview-h.html">qlistview.h</a>&gt;</tt>
<p>Inherits <a href="qlistviewitem.html">QListViewItem</a>.
<p><a href="qchecklistitem-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn>enum <a href="#Type-enum"><b>Type</b></a> { RadioButton, CheckBox, Controller, RadioButtonController = Controller, CheckBoxController }</li>
<li class=fn>enum <a href="#ToggleState-enum"><b>ToggleState</b></a> { Off, NoChange, On }</li>
<li class=fn><a href="#QCheckListItem"><b>QCheckListItem</b></a> ( QCheckListItem&nbsp;*&nbsp;parent, const&nbsp;QString&nbsp;&amp;&nbsp;text, Type&nbsp;tt = RadioButtonController )</li>
<li class=fn><a href="#QCheckListItem-2"><b>QCheckListItem</b></a> ( QCheckListItem&nbsp;*&nbsp;parent, QListViewItem&nbsp;*&nbsp;after, const&nbsp;QString&nbsp;&amp;&nbsp;text, Type&nbsp;tt = RadioButtonController )</li>
<li class=fn><a href="#QCheckListItem-3"><b>QCheckListItem</b></a> ( QListViewItem&nbsp;*&nbsp;parent, const&nbsp;QString&nbsp;&amp;&nbsp;text, Type&nbsp;tt = RadioButtonController )</li>
<li class=fn><a href="#QCheckListItem-4"><b>QCheckListItem</b></a> ( QListViewItem&nbsp;*&nbsp;parent, QListViewItem&nbsp;*&nbsp;after, const&nbsp;QString&nbsp;&amp;&nbsp;text, Type&nbsp;tt = RadioButtonController )</li>
<li class=fn><a href="#QCheckListItem-5"><b>QCheckListItem</b></a> ( QListView&nbsp;*&nbsp;parent, const&nbsp;QString&nbsp;&amp;&nbsp;text, Type&nbsp;tt = RadioButtonController )</li>
<li class=fn><a href="#QCheckListItem-6"><b>QCheckListItem</b></a> ( QListView&nbsp;*&nbsp;parent, QListViewItem&nbsp;*&nbsp;after, const&nbsp;QString&nbsp;&amp;&nbsp;text, Type&nbsp;tt = RadioButtonController )</li>
<li class=fn><a href="#QCheckListItem-7"><b>QCheckListItem</b></a> ( QListViewItem&nbsp;*&nbsp;parent, const&nbsp;QString&nbsp;&amp;&nbsp;text, const&nbsp;QPixmap&nbsp;&amp;&nbsp;p )</li>
<li class=fn><a href="#QCheckListItem-8"><b>QCheckListItem</b></a> ( QListView&nbsp;*&nbsp;parent, const&nbsp;QString&nbsp;&amp;&nbsp;text, const&nbsp;QPixmap&nbsp;&amp;&nbsp;p )</li>
<li class=fn><a href="#~QCheckListItem"><b>~QCheckListItem</b></a> ()</li>
<li class=fn>virtual void <a href="#paintCell"><b>paintCell</b></a> ( QPainter&nbsp;*&nbsp;p, const&nbsp;QColorGroup&nbsp;&amp;&nbsp;cg, int&nbsp;column, int&nbsp;width, int&nbsp;align )</li>
<li class=fn>virtual void <a href="#paintFocus"><b>paintFocus</b></a> ( QPainter&nbsp;*&nbsp;p, const&nbsp;QColorGroup&nbsp;&amp;&nbsp;cg, const&nbsp;QRect&nbsp;&amp;&nbsp;r )</li>
<li class=fn>virtual void <a href="#setOn"><b>setOn</b></a> ( bool&nbsp;b )</li>
<li class=fn>bool <a href="#isOn"><b>isOn</b></a> () const</li>
<li class=fn>Type <a href="#type"><b>type</b></a> () const</li>
<li class=fn>QString <a href="#text"><b>text</b></a> () const</li>
<li class=fn>void <a href="#setTristate"><b>setTristate</b></a> ( bool&nbsp;b )</li>
<li class=fn>bool <a href="#isTristate"><b>isTristate</b></a> () const</li>
<li class=fn>ToggleState <a href="#state"><b>state</b></a> () const</li>
<li class=fn>void <a href="#setState"><b>setState</b></a> ( ToggleState&nbsp;s )</li>
<li class=fn>virtual int <a href="#rtti"><b>rtti</b></a> () const</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>virtual void <a href="#activate"><b>activate</b></a> ()</li>
<li class=fn>void <a href="#turnOffChild"><b>turnOffChild</b></a> ()</li>
<li class=fn>virtual void <a href="#stateChange"><b>stateChange</b></a> ( bool )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The QCheckListItem class provides checkable list view items.
<p> 
<p> QCheckListItems are used in <a href="qlistview.html">QListView</a>s to provide
<a href="qlistviewitem.html">QListViewItem</a>s that are checkboxes, radio buttons or
controllers.
<p> Checkbox and controller check list items may be inserted at any
level in a list view. Radio button check list items must be
children of a controller check list item.
<p> The item can be checked or unchecked with <a href="#setOn">setOn</a>(). Its type can be
retrieved with <a href="#type">type</a>() and its text retrieved with <a href="#text">text</a>().
<p> <center><img src="qlistviewitems.png" alt="List View Items"></center> 
<p> <p>See also <a href="qlistviewitem.html">QListViewItem</a>, <a href="qlistview.html">QListView</a>, and <a href="advanced.html">Advanced Widgets</a>.

<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="ToggleState-enum"></a>QCheckListItem::ToggleState</h3>

<p> This enum specifies a QCheckListItem's toggle state.
<ul>
<li><tt>QCheckListItem::Off</tt>
<li><tt>QCheckListItem::NoChange</tt>
<li><tt>QCheckListItem::On</tt>
</ul>
<h3 class=fn><a name="Type-enum"></a>QCheckListItem::Type</h3>

<p> This enum type specifies a QCheckListItem's type:
<ul>
<li><tt>QCheckListItem::RadioButton</tt>
<li><tt>QCheckListItem::CheckBox</tt>
<li><tt>QCheckListItem::Controller</tt> - <em>obsolete</em> (use <a href="#Type-enum">RadioButtonController</a> instead)
<li><tt>QCheckListItem::RadioButtonController</tt>
<li><tt>QCheckListItem::CheckBoxController</tt>
</ul>
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QCheckListItem"></a>QCheckListItem::QCheckListItem ( <a href="qchecklistitem.html">QCheckListItem</a>&nbsp;*&nbsp;parent, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, <a href="qchecklistitem.html#Type-enum">Type</a>&nbsp;tt = RadioButtonController )
</h3>
Constructs a checkable item with parent <em>parent</em>, text <em>text</em>
and of type <em>tt</em>. Note that a <a href="#Type-enum">RadioButton</a> must be the child of a
<a href="#Type-enum">RadioButtonController</a>, otherwise it will not toggle.

<h3 class=fn><a name="QCheckListItem-2"></a>QCheckListItem::QCheckListItem ( <a href="qchecklistitem.html">QCheckListItem</a>&nbsp;*&nbsp;parent, <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;after, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, <a href="qchecklistitem.html#Type-enum">Type</a>&nbsp;tt = RadioButtonController )
</h3>
Constructs a checkable item with parent <em>parent</em>, which is after
<em>after</em> in the parent's list of children, and with text <em>text</em>
and of type <em>tt</em>. Note that a <a href="#Type-enum">RadioButton</a> must be the child of
a <a href="#Type-enum">RadioButtonController</a>, otherwise it will not toggle.

<h3 class=fn><a name="QCheckListItem-3"></a>QCheckListItem::QCheckListItem ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;parent, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, <a href="qchecklistitem.html#Type-enum">Type</a>&nbsp;tt = RadioButtonController )
</h3>
Constructs a checkable item with parent <em>parent</em>, text <em>text</em>
and of type <em>tt</em>. Note that this item must <em>not</em> be a <a href="#Type-enum">RadioButton</a>. Radio buttons must be children of a <a href="#Type-enum">RadioButtonController</a>.

<h3 class=fn><a name="QCheckListItem-4"></a>QCheckListItem::QCheckListItem ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;parent, <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;after, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, <a href="qchecklistitem.html#Type-enum">Type</a>&nbsp;tt = RadioButtonController )
</h3>
Constructs a checkable item with parent <em>parent</em>, which is after
<em>after</em> in the parent's list of children, with text <em>text</em> and
of type <em>tt</em>. Note that this item must <em>not</em> be a <a href="#Type-enum">RadioButton</a>. Radio buttons must be children of a <a href="#Type-enum">RadioButtonController</a>.

<h3 class=fn><a name="QCheckListItem-5"></a>QCheckListItem::QCheckListItem ( <a href="qlistview.html">QListView</a>&nbsp;*&nbsp;parent, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, <a href="qchecklistitem.html#Type-enum">Type</a>&nbsp;tt = RadioButtonController )
</h3>
Constructs a checkable item with parent <em>parent</em>, text <em>text</em>
and of type <em>tt</em>. Note that <em>tt</em> must <em>not</em> be <a href="#Type-enum">RadioButton</a>.
Radio buttons must be children of a <a href="#Type-enum">RadioButtonController</a>.

<h3 class=fn><a name="QCheckListItem-6"></a>QCheckListItem::QCheckListItem ( <a href="qlistview.html">QListView</a>&nbsp;*&nbsp;parent, <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;after, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, <a href="qchecklistitem.html#Type-enum">Type</a>&nbsp;tt = RadioButtonController )
</h3>
Constructs a checkable item with parent <em>parent</em>, which is after
<em>after</em> in the parent's list of children, with text <em>text</em> and
of type <em>tt</em>. Note that <em>tt</em> must <em>not</em> be <a href="#Type-enum">RadioButton</a>.
Radio buttons must be children of a <a href="#Type-enum">RadioButtonController</a>.

<h3 class=fn><a name="QCheckListItem-7"></a>QCheckListItem::QCheckListItem ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;parent, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;p )
</h3>
Constructs a <a href="#Type-enum">RadioButtonController</a> item with parent <em>parent</em>,
text <em>text</em> and pixmap <em>p</em>.

<h3 class=fn><a name="QCheckListItem-8"></a>QCheckListItem::QCheckListItem ( <a href="qlistview.html">QListView</a>&nbsp;*&nbsp;parent, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;p )
</h3>
Constructs a <a href="#Type-enum">RadioButtonController</a> item with parent <em>parent</em>,
text <em>text</em> and pixmap <em>p</em>.

<h3 class=fn><a name="~QCheckListItem"></a>QCheckListItem::~QCheckListItem ()
</h3>
Destroys the item, and all its children to any depth, freeing up
all allocated resources.

<h3 class=fn>void <a name="activate"></a>QCheckListItem::activate ()<tt> [virtual protected]</tt>
</h3>
Toggle check box or set radio button to on.

<p>Reimplemented from <a href="qlistviewitem.html#activate">QListViewItem</a>.
<h3 class=fn>bool <a name="isOn"></a>QCheckListItem::isOn () const
</h3>

<p> Returns TRUE if the item is toggled on; otherwise returns FALSE.

<h3 class=fn>bool <a name="isTristate"></a>QCheckListItem::isTristate () const
</h3>
Returns TRUE if the item is tristate; otherwise returns FALSE.
<p> <p>See also <a href="#setTristate">setTristate</a>().

<h3 class=fn>void <a name="paintCell"></a>QCheckListItem::paintCell ( <a href="qpainter.html">QPainter</a>&nbsp;*&nbsp;p, const&nbsp;<a href="qcolorgroup.html">QColorGroup</a>&nbsp;&amp;&nbsp;cg, int&nbsp;column, int&nbsp;width, int&nbsp;align )<tt> [virtual]</tt>
</h3>
Paints the item using the painter <em>p</em> and the color group <em>cg</em>.
The item is in column <em>column</em>, has width <em>width</em> and has
alignment <em>align</em>. (See Qt::AlignmentFlags for valid alignments.)

<p>Reimplemented from <a href="qlistviewitem.html#paintCell">QListViewItem</a>.
<h3 class=fn>void <a name="paintFocus"></a>QCheckListItem::paintFocus ( <a href="qpainter.html">QPainter</a>&nbsp;*&nbsp;p, const&nbsp;<a href="qcolorgroup.html">QColorGroup</a>&nbsp;&amp;&nbsp;cg, const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )<tt> [virtual]</tt>
</h3>
Draws the focus rectangle <em>r</em> using the color group <em>cg</em> on the
painter <em>p</em>.

<p>Reimplemented from <a href="qlistviewitem.html#paintFocus">QListViewItem</a>.
<h3 class=fn>int <a name="rtti"></a>QCheckListItem::rtti () const<tt> [virtual]</tt>
</h3>

<p> Returns 1.
<p> Make your derived classes return their own values for <a href="#rtti">rtti</a>(), and
you can distinguish between list view items. You should use values
greater than 1000, to allow for extensions to this class.

<p>Reimplemented from <a href="qlistviewitem.html#rtti">QListViewItem</a>.
<h3 class=fn>void <a name="setOn"></a>QCheckListItem::setOn ( bool&nbsp;b )<tt> [virtual]</tt>
</h3>
Sets the button on if <em>b</em> is TRUE, otherwise sets it off.
Maintains radio button exclusivity.

<h3 class=fn>void <a name="setState"></a>QCheckListItem::setState ( <a href="qchecklistitem.html#ToggleState-enum">ToggleState</a>&nbsp;s )
</h3>
Sets the toggle state of the checklistitem to <em>s</em>. <em>s</em> can be
<a href="#ToggleState-enum">Off</a>, <a href="#ToggleState-enum">NoChange</a> or <a href="#ToggleState-enum">On</a>.
<p> Tristate can only be enabled for <a href="#Type-enum">CheckBox</a> or <a href="#Type-enum">CheckBoxController</a>,
therefore the <a href="#ToggleState-enum">NoChange</a> only applies to them.
<p> Setting the state to <a href="#ToggleState-enum">On</a> or <a href="#ToggleState-enum">Off</a> on a <a href="#Type-enum">CheckBoxController</a>
will recursivly set the states of its children to the same state.
<p> Setting the state to <a href="#ToggleState-enum">NoChange</a> on a <a href="#Type-enum">CheckBoxController</a> will
make it recursivly recall the previous stored state of its
children. If there was no previous stored state the children are
all set to <a href="#ToggleState-enum">On</a>.

<h3 class=fn>void <a name="setTristate"></a>QCheckListItem::setTristate ( bool&nbsp;b )
</h3>
Sets tristate to <em>b</em> if the <a href="#Type-enum">Type</a> is either a <a href="#Type-enum">CheckBoxController</a> or
a <a href="#Type-enum">CheckBox</a>.
<p> <tt>CheckBoxControllers</tt> are tristate by default.
<p> <p>See also <a href="#state">state</a>() and <a href="#isTristate">isTristate</a>().

<h3 class=fn><a href="qchecklistitem.html#ToggleState-enum">ToggleState</a> <a name="state"></a>QCheckListItem::state () const
</h3>
Returns the state of the item.
<p> <p>See also <a href="#ToggleState-enum">QCheckListItem::ToggleState</a>.

<h3 class=fn>void <a name="stateChange"></a>QCheckListItem::stateChange ( bool )<tt> [virtual protected]</tt>
</h3>
This virtual function is called when the item changes its state.
<a href="#ToggleState-enum">NoChange</a> (if tristate is enabled and the type is either <a href="#Type-enum">CheckBox</a> or <a href="#Type-enum">CheckBoxController</a>) reports the same as <a href="#ToggleState-enum">Off</a>, so
use <a href="#state">state</a>() to determine if the state is actually <a href="#ToggleState-enum">Off</a> or <a href="#ToggleState-enum">NoChange</a>.

<h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QCheckListItem::text () const
</h3>

<p> Returns the item's text.

<h3 class=fn>void <a name="turnOffChild"></a>QCheckListItem::turnOffChild ()<tt> [protected]</tt>
</h3>
If this is a <a href="#Type-enum">RadioButtonController</a> that has <a href="#Type-enum">RadioButton</a>
children, turn off the child that is on.

<h3 class=fn><a href="qchecklistitem.html#Type-enum">Type</a> <a name="type"></a>QCheckListItem::type () const
</h3>

<p> Returns the type of this item.

<!-- 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>