source: trunk/doc/html/qchecklistitem.html

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

reference documentation added

File size: 16.6 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/qlistview.cpp:5987 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QCheckListItem 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>QCheckListItem Class Reference</h1>
33
34<p>The QCheckListItem class provides checkable list view items.
35<a href="#details">More...</a>
36<p><tt>#include &lt;<a href="qlistview-h.html">qlistview.h</a>&gt;</tt>
37<p>Inherits <a href="qlistviewitem.html">QListViewItem</a>.
38<p><a href="qchecklistitem-members.html">List of all member functions.</a>
39<h2>Public Members</h2>
40<ul>
41<li class=fn>enum <a href="#Type-enum"><b>Type</b></a> { RadioButton, CheckBox, Controller, RadioButtonController = Controller, CheckBoxController }</li>
42<li class=fn>enum <a href="#ToggleState-enum"><b>ToggleState</b></a> { Off, NoChange, On }</li>
43<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>
44<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>
45<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>
46<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>
47<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>
48<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>
49<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>
50<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>
51<li class=fn><a href="#~QCheckListItem"><b>~QCheckListItem</b></a> ()</li>
52<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>
53<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>
54<li class=fn>virtual void <a href="#setOn"><b>setOn</b></a> ( bool&nbsp;b )</li>
55<li class=fn>bool <a href="#isOn"><b>isOn</b></a> () const</li>
56<li class=fn>Type <a href="#type"><b>type</b></a> () const</li>
57<li class=fn>QString <a href="#text"><b>text</b></a> () const</li>
58<li class=fn>void <a href="#setTristate"><b>setTristate</b></a> ( bool&nbsp;b )</li>
59<li class=fn>bool <a href="#isTristate"><b>isTristate</b></a> () const</li>
60<li class=fn>ToggleState <a href="#state"><b>state</b></a> () const</li>
61<li class=fn>void <a href="#setState"><b>setState</b></a> ( ToggleState&nbsp;s )</li>
62<li class=fn>virtual int <a href="#rtti"><b>rtti</b></a> () const</li>
63</ul>
64<h2>Protected Members</h2>
65<ul>
66<li class=fn>virtual void <a href="#activate"><b>activate</b></a> ()</li>
67<li class=fn>void <a href="#turnOffChild"><b>turnOffChild</b></a> ()</li>
68<li class=fn>virtual void <a href="#stateChange"><b>stateChange</b></a> ( bool )</li>
69</ul>
70<hr><a name="details"></a><h2>Detailed Description</h2>
71
72
73The QCheckListItem class provides checkable list view items.
74<p>
75<p> QCheckListItems are used in <a href="qlistview.html">QListView</a>s to provide
76<a href="qlistviewitem.html">QListViewItem</a>s that are checkboxes, radio buttons or
77controllers.
78<p> Checkbox and controller check list items may be inserted at any
79level in a list view. Radio button check list items must be
80children of a controller check list item.
81<p> The item can be checked or unchecked with <a href="#setOn">setOn</a>(). Its type can be
82retrieved with <a href="#type">type</a>() and its text retrieved with <a href="#text">text</a>().
83<p> <center><img src="qlistviewitems.png" alt="List View Items"></center>
84<p> <p>See also <a href="qlistviewitem.html">QListViewItem</a>, <a href="qlistview.html">QListView</a>, and <a href="advanced.html">Advanced Widgets</a>.
85
86<hr><h2>Member Type Documentation</h2>
87<h3 class=fn><a name="ToggleState-enum"></a>QCheckListItem::ToggleState</h3>
88
89<p> This enum specifies a QCheckListItem's toggle state.
90<ul>
91<li><tt>QCheckListItem::Off</tt>
92<li><tt>QCheckListItem::NoChange</tt>
93<li><tt>QCheckListItem::On</tt>
94</ul>
95<h3 class=fn><a name="Type-enum"></a>QCheckListItem::Type</h3>
96
97<p> This enum type specifies a QCheckListItem's type:
98<ul>
99<li><tt>QCheckListItem::RadioButton</tt>
100<li><tt>QCheckListItem::CheckBox</tt>
101<li><tt>QCheckListItem::Controller</tt> - <em>obsolete</em> (use <a href="#Type-enum">RadioButtonController</a> instead)
102<li><tt>QCheckListItem::RadioButtonController</tt>
103<li><tt>QCheckListItem::CheckBoxController</tt>
104</ul>
105<hr><h2>Member Function Documentation</h2>
106<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 )
107</h3>
108Constructs a checkable item with parent <em>parent</em>, text <em>text</em>
109and of type <em>tt</em>. Note that a <a href="#Type-enum">RadioButton</a> must be the child of a
110<a href="#Type-enum">RadioButtonController</a>, otherwise it will not toggle.
111
112<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 )
113</h3>
114Constructs a checkable item with parent <em>parent</em>, which is after
115<em>after</em> in the parent's list of children, and with text <em>text</em>
116and of type <em>tt</em>. Note that a <a href="#Type-enum">RadioButton</a> must be the child of
117a <a href="#Type-enum">RadioButtonController</a>, otherwise it will not toggle.
118
119<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 )
120</h3>
121Constructs a checkable item with parent <em>parent</em>, text <em>text</em>
122and 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>.
123
124<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 )
125</h3>
126Constructs a checkable item with parent <em>parent</em>, which is after
127<em>after</em> in the parent's list of children, with text <em>text</em> and
128of 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>.
129
130<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 )
131</h3>
132Constructs a checkable item with parent <em>parent</em>, text <em>text</em>
133and of type <em>tt</em>. Note that <em>tt</em> must <em>not</em> be <a href="#Type-enum">RadioButton</a>.
134Radio buttons must be children of a <a href="#Type-enum">RadioButtonController</a>.
135
136<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 )
137</h3>
138Constructs a checkable item with parent <em>parent</em>, which is after
139<em>after</em> in the parent's list of children, with text <em>text</em> and
140of type <em>tt</em>. Note that <em>tt</em> must <em>not</em> be <a href="#Type-enum">RadioButton</a>.
141Radio buttons must be children of a <a href="#Type-enum">RadioButtonController</a>.
142
143<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 )
144</h3>
145Constructs a <a href="#Type-enum">RadioButtonController</a> item with parent <em>parent</em>,
146text <em>text</em> and pixmap <em>p</em>.
147
148<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 )
149</h3>
150Constructs a <a href="#Type-enum">RadioButtonController</a> item with parent <em>parent</em>,
151text <em>text</em> and pixmap <em>p</em>.
152
153<h3 class=fn><a name="~QCheckListItem"></a>QCheckListItem::~QCheckListItem ()
154</h3>
155Destroys the item, and all its children to any depth, freeing up
156all allocated resources.
157
158<h3 class=fn>void <a name="activate"></a>QCheckListItem::activate ()<tt> [virtual protected]</tt>
159</h3>
160Toggle check box or set radio button to on.
161
162<p>Reimplemented from <a href="qlistviewitem.html#activate">QListViewItem</a>.
163<h3 class=fn>bool <a name="isOn"></a>QCheckListItem::isOn () const
164</h3>
165
166<p> Returns TRUE if the item is toggled on; otherwise returns FALSE.
167
168<h3 class=fn>bool <a name="isTristate"></a>QCheckListItem::isTristate () const
169</h3>
170Returns TRUE if the item is tristate; otherwise returns FALSE.
171<p> <p>See also <a href="#setTristate">setTristate</a>().
172
173<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>
174</h3>
175Paints the item using the painter <em>p</em> and the color group <em>cg</em>.
176The item is in column <em>column</em>, has width <em>width</em> and has
177alignment <em>align</em>. (See Qt::AlignmentFlags for valid alignments.)
178
179<p>Reimplemented from <a href="qlistviewitem.html#paintCell">QListViewItem</a>.
180<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>
181</h3>
182Draws the focus rectangle <em>r</em> using the color group <em>cg</em> on the
183painter <em>p</em>.
184
185<p>Reimplemented from <a href="qlistviewitem.html#paintFocus">QListViewItem</a>.
186<h3 class=fn>int <a name="rtti"></a>QCheckListItem::rtti () const<tt> [virtual]</tt>
187</h3>
188
189<p> Returns 1.
190<p> Make your derived classes return their own values for <a href="#rtti">rtti</a>(), and
191you can distinguish between list view items. You should use values
192greater than 1000, to allow for extensions to this class.
193
194<p>Reimplemented from <a href="qlistviewitem.html#rtti">QListViewItem</a>.
195<h3 class=fn>void <a name="setOn"></a>QCheckListItem::setOn ( bool&nbsp;b )<tt> [virtual]</tt>
196</h3>
197Sets the button on if <em>b</em> is TRUE, otherwise sets it off.
198Maintains radio button exclusivity.
199
200<h3 class=fn>void <a name="setState"></a>QCheckListItem::setState ( <a href="qchecklistitem.html#ToggleState-enum">ToggleState</a>&nbsp;s )
201</h3>
202Sets the toggle state of the checklistitem to <em>s</em>. <em>s</em> can be
203<a href="#ToggleState-enum">Off</a>, <a href="#ToggleState-enum">NoChange</a> or <a href="#ToggleState-enum">On</a>.
204<p> Tristate can only be enabled for <a href="#Type-enum">CheckBox</a> or <a href="#Type-enum">CheckBoxController</a>,
205therefore the <a href="#ToggleState-enum">NoChange</a> only applies to them.
206<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>
207will recursivly set the states of its children to the same state.
208<p> Setting the state to <a href="#ToggleState-enum">NoChange</a> on a <a href="#Type-enum">CheckBoxController</a> will
209make it recursivly recall the previous stored state of its
210children. If there was no previous stored state the children are
211all set to <a href="#ToggleState-enum">On</a>.
212
213<h3 class=fn>void <a name="setTristate"></a>QCheckListItem::setTristate ( bool&nbsp;b )
214</h3>
215Sets tristate to <em>b</em> if the <a href="#Type-enum">Type</a> is either a <a href="#Type-enum">CheckBoxController</a> or
216a <a href="#Type-enum">CheckBox</a>.
217<p> <tt>CheckBoxControllers</tt> are tristate by default.
218<p> <p>See also <a href="#state">state</a>() and <a href="#isTristate">isTristate</a>().
219
220<h3 class=fn><a href="qchecklistitem.html#ToggleState-enum">ToggleState</a> <a name="state"></a>QCheckListItem::state () const
221</h3>
222Returns the state of the item.
223<p> <p>See also <a href="#ToggleState-enum">QCheckListItem::ToggleState</a>.
224
225<h3 class=fn>void <a name="stateChange"></a>QCheckListItem::stateChange ( bool )<tt> [virtual protected]</tt>
226</h3>
227This virtual function is called when the item changes its state.
228<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
229use <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>.
230
231<h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QCheckListItem::text () const
232</h3>
233
234<p> Returns the item's text.
235
236<h3 class=fn>void <a name="turnOffChild"></a>QCheckListItem::turnOffChild ()<tt> [protected]</tt>
237</h3>
238If this is a <a href="#Type-enum">RadioButtonController</a> that has <a href="#Type-enum">RadioButton</a>
239children, turn off the child that is on.
240
241<h3 class=fn><a href="qchecklistitem.html#Type-enum">Type</a> <a name="type"></a>QCheckListItem::type () const
242</h3>
243
244<p> Returns the type of this item.
245
246<!-- eof -->
247<hr><p>
248This file is part of the <a href="index.html">Qt toolkit</a>.
249Copyright &copy; 1995-2007
250<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
251<table width=100% cellspacing=0 border=0><tr>
252<td>Copyright &copy; 2007
253<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
254<td align=right><div align=right>Qt 3.3.8</div>
255</table></div></address></body>
256</html>
Note: See TracBrowser for help on using the repository browser.