File: qtableitem.html

package info (click to toggle)
qt-embedded 2.3.2-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 68,608 kB
  • ctags: 45,998
  • sloc: cpp: 276,654; ansic: 71,987; makefile: 29,074; sh: 12,305; yacc: 2,465; python: 1,863; perl: 481; lex: 480; xml: 68; lisp: 15
file content (198 lines) | stat: -rw-r--r-- 13,696 bytes parent folder | download
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QTableItem Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">

<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>

<h1 align=center>QTableItem Class Reference<br><small>[ <a href="table.html">table module</a> ]</small></h1><br clear="all">
<p>
The QTableItem class provides content for one cell in a <a href="qtable.html">QTable</a>.
<a href="#details">More...</a>
<p>
<code>#include &lt;<a href="qtable-h.html">qtable.h</a>&gt;</code>
<p>
Inherits <a href="qt.html">Qt</a>.
<p><a href="qtableitem-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn">enum<a href="#EditType"><b>EditType</b></a>{Never, OnTyping, WhenCurrent, Always}</div>
<li><div class="fn"><a href="#d6318f"><b>QTableItem</b></a>(QTable*table, EditTypeet, constQString&amp;text)</div>
<li><div class="fn"><a href="#39e943"><b>QTableItem</b></a>(QTable*table, EditTypeet, constQString&amp;text, constQPixmap&amp;p)</div>
<li><div class="fn">virtual<a href="#7e1136"><b>~QTableItem</b></a>()</div>
<li><div class="fn">virtualQPixmap<a href="#b8f6bb"><b>pixmap</b></a>()const</div>
<li><div class="fn">virtualQString<a href="#22eb16"><b>text</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#169f43"><b>setPixmap</b></a>(constQPixmap&amp;p)</div>
<li><div class="fn">virtualvoid<a href="#733714"><b>setText</b></a>(constQString&amp;t)</div>
<li><div class="fn">QTable*<a href="#8288d6"><b>table</b></a>()const</div>
<li><div class="fn">virtualint<a href="#06cabd"><b>alignment</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#29f6c2"><b>setWordWrap</b></a>(boolb)</div>
<li><div class="fn">bool<a href="#a0bb67"><b>wordWrap</b></a>()const</div>
<li><div class="fn">EditType<a href="#12335f"><b>editType</b></a>()const</div>
<li><div class="fn">virtualQWidget*<a href="#677456"><b>createEditor</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#b43c3b"><b>setContentFromEditor</b></a>(QWidget*w)</div>
<li><div class="fn">virtualvoid<a href="#551f62"><b>setReplaceable</b></a>(bool)</div>
<li><div class="fn">bool<a href="#6291e6"><b>isReplaceable</b></a>()const</div>
<li><div class="fn">virtualQString<a href="#5c1c3a"><b>key</b></a>()const</div>
<li><div class="fn">virtualQSize<a href="#6b789b"><b>sizeHint</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#cca834"><b>setSpan</b></a>(intrs, intcs)</div>
<li><div class="fn">int<a href="#1c2689"><b>rowSpan</b></a>()const</div>
<li><div class="fn">int<a href="#f9588b"><b>colSpan</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#5f7c79"><b>setRow</b></a>(intr)</div>
<li><div class="fn">virtualvoid<a href="#a210c9"><b>setCol</b></a>(intc)</div>
<li><div class="fn">int<a href="#a66ca9"><b>row</b></a>()const</div>
<li><div class="fn">int<a href="#d36c2e"><b>col</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#8c6156"><b>paint</b></a>(QPainter*p, constQColorGroup&amp;cg, constQRect&amp;cr, boolselected)</div>
<li><div class="fn">void<b>updateEditor</b>(intoldRow, intoldCol)(internal)</div>
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QTableItem class provides content for one cell in a <a href="qtable.html">QTable</a>.
<p>
A QTableItem contains the data of a table cell, specifies its edit
type and the editor used to change its content. Furthermore, it
defines its size, the alignment of the data to display, whether the
data can be replaced, and provides the API needed for sorting table
items.
<p>Items may contain text and pixmaps and offer a <a href="qlineedit.html">QLineEdit</a> for
editing.  By reimplementing <a href="#8c6156">paint</a>(), <a href="#5c1c3a">key</a>(), <a href="#677456">createEditor</a>() and
<a href="#b43c3b">setContentFromEditor</a>() you can change these default settings.
<p>To get rid of an item, simply delete it. By doing so, all required
actions for removing it from the table will be taken.

<hr><h2>Member Type Documentation</h2>
<h3 class="fn"><a name="EditType">QTableItem::EditType</a></h3>
This enum type defines whether and when the user may edit a table
cell.  The currently defined states are:
<p><ul>
<li><code>Always</code> - the cell always is and always looks editable.
<li><code>WhenCurrent</code> - the cell is editable, and looks editable
whenever it has keyboard focus (see <a href="qtable.html#ebd94d">QTable::setCurrentCell</a>()).
<li><code>OnTyping</code> - the cell is editable, but looks editable only when
the user types in it or double-clicks in it. (This is like <code>WhenCurrent</code> in function but can look a bit cleaner.)
<li><code>Never</code> - the cell isn't editable.
<p></ul>
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="d6318f"></a>QTableItem::QTableItem(<a href="qtable.html">QTable</a>*table, <a href="qtableitem.html#EditType">EditType</a>et, const<a href="qstring.html">QString</a>&amp;text)</h3>
<p>Creates a table item for the table <em>table</em> that contains the text
<em>text.</em>
<h3 class="fn"><a name="39e943"></a>QTableItem::QTableItem(<a href="qtable.html">QTable</a>*table, <a href="qtableitem.html#EditType">EditType</a>et, const<a href="qstring.html">QString</a>&amp;text, const<a href="qpixmap.html">QPixmap</a>&amp;p)</h3>
<p>Creates an item for the table <em>table</em> with the text <em>text</em> and the
pixmap <em>p.</em>
<h3 class="fn"><a name="7e1136"></a>QTableItem::~QTableItem() <code>[virtual]</code></h3>
<p>Destructor.
<h3 class="fn">int<a name="06cabd"></a>QTableItem::alignment()const <code>[virtual]</code></h3>
<p>The alignment function returns how the contents of the cell are
drawn. The default implementation aligns numbers to the right and
other text to the left.
<h3 class="fn">int<a name="d36c2e"></a>QTableItem::col()const</h3>
<p>Returns the column where the item is located.  If the cell spans
multiple columns, this function returns the leftmost column.
<h3 class="fn">int<a name="f9588b"></a>QTableItem::colSpan()const</h3>
<p>Returns teh column span of the item, normally 1.
<p>See also  <a href="#cca834">setSpan</a>().
<h3 class="fn"><a href="qwidget.html">QWidget</a>*<a name="677456"></a>QTableItem::createEditor()const <code>[virtual]</code></h3>
<p>This virtual function creates the editor with which the user can
edit the cell.  The default implementation creates a <a href="qlineedit.html">QLineEdit</a>.
<p>If the function returns 0, that the cell can not be edited.
<p>The returned widget should preferably not be visible, and it should
preferably have <a href="qscrollview.html#26f2bf">QTable::viewport</a>() as parent.
<p>If you reimplement this function, you probably also need to
reimplement <a href="#b43c3b">setContentFromEditor</a>().
<p>See also  <a href="qtable.html#7a7d15">QTable::createEditor</a>(), <a href="#b43c3b">setContentFromEditor</a>() and <a href="qscrollview.html#26f2bf">QTable::viewport</a>().
<h3 class="fn">QTableItem::EditType<a name="12335f"></a>QTableItem::editType()const</h3>
<p>Returns the edit type of an item.
<p>See also  <a href="#EditType">EditType</a>.
<h3 class="fn">bool<a name="6291e6"></a>QTableItem::isReplaceable()const</h3>
<p>This function returns whether the relevant QTableItem can be replaced
or not. Only items that cover no more than one cell might be replaced.
<p>See also  <a href="#551f62">setReplaceable</a>().
<h3 class="fn"><a href="qstring.html">QString</a><a name="5c1c3a"></a>QTableItem::key()const <code>[virtual]</code></h3>
<p>This virtual function returns the key that should be used for
sorting. The default implementation returns the <a href="#22eb16">text</a>() of the
relevant item.
<h3 class="fn">void<a name="8c6156"></a>QTableItem::paint(<a href="qpainter.html">QPainter</a>*p, const<a href="qcolorgroup.html">QColorGroup</a>&amp;cg, const<a href="qrect.html">QRect</a>&amp;cr, boolselected) <code>[virtual]</code></h3>
<p>In order to paint the contents of an item call <em>QTableItem::paint().</em>
<h3 class="fn"><a href="qpixmap.html">QPixmap</a><a name="b8f6bb"></a>QTableItem::pixmap()const <code>[virtual]</code></h3>
<p>Returns the item's pixmap.
<h3 class="fn">int<a name="a66ca9"></a>QTableItem::row()const</h3>
<p>Returns the row where the item is located.  If the cell spans
multiple rows, this function returns the top row.
<h3 class="fn">int<a name="1c2689"></a>QTableItem::rowSpan()const</h3>
<p>Returns the row span of an item, normally 1.
<p>See also  <a href="#cca834">setSpan</a>().
<h3 class="fn">void<a name="a210c9"></a>QTableItem::setCol(intc) <code>[virtual]</code></h3>
<p>Sets the item's column to be <em>c.</em>  Normally you will not need to
call this function.
<p>If the cell spans multiple columns, this function sets the leftmost
column and retains the width.
<h3 class="fn">void<a name="b43c3b"></a>QTableItem::setContentFromEditor(<a href="qwidget.html">QWidget</a>*w) <code>[virtual]</code></h3>
<p>Whenever the content of a cell has been edited by the editor <em>w,</em> <a href="qtable.html">QTable</a> calls this virtual function to copy the new values into
the QTableItem.
<p>You probably <em>must</em> reimplement this function if you reimplement
<a href="#677456">createEditor</a>() and return something that is not a <a href="qlineedit.html">QLineEdit</a>.
<p>See also  QTable::setContentFromEditor().
<h3 class="fn">void<a name="169f43"></a>QTableItem::setPixmap(const<a href="qpixmap.html">QPixmap</a>&amp;p) <code>[virtual]</code></h3>
<p>Sets the item pixmap to <em>pix.</em> QTableItem::setPixmap(), however,
does not repaint the cell.
<h3 class="fn">void<a name="551f62"></a>QTableItem::setReplaceable(boolb) <code>[virtual]</code></h3>
<p>If it shouldn't be possible to replace the contents of the relevant cell
with those of another QTableItem, set <em>b</em> to FALSE.
<h3 class="fn">void<a name="5f7c79"></a>QTableItem::setRow(intr) <code>[virtual]</code></h3>
<p>Sets the item's row to be <em>row.</em>  Normally you will not need to
call this function.
<p>If the cell spans multiple rows, this function sets the top row and
retains the height.
<h3 class="fn">void<a name="cca834"></a>QTableItem::setSpan(intrs, intcs) <code>[virtual]</code></h3>
<p>Creates a multi-cell QTableItem covering <em>rs</em> rows and <em>cs</em>
columns.  The top left corner of the item is at the item's former
position.<p><b>Warning:</b> This function only works, if the item has already been
inserted into the table using e.g. <a href="qtable.html#21a0c9">QTable::setItem</a>().
<h3 class="fn">void<a name="733714"></a>QTableItem::setText(const<a href="qstring.html">QString</a>&amp;str) <code>[virtual]</code></h3>
<p>Changes the text of the item to <em>str.</em> Note that the cell is not
repainted.
<h3 class="fn">void<a name="29f6c2"></a>QTableItem::setWordWrap(boolb) <code>[virtual]</code></h3>
<p>If <em>b</em> is TRUE, the cell's text is wrapped into multiple lines,
otherwise it will be written on one line.
<h3 class="fn"><a href="qsize.html">QSize</a><a name="6b789b"></a>QTableItem::sizeHint()const <code>[virtual]</code></h3>
<p>This virtual function returns the size a cell needs to show its
entire content.
<p>Many custom table items will need to reimplement this function.
<h3 class="fn"><a href="qtable.html">QTable</a>*<a name="8288d6"></a>QTableItem::table()const</h3>
<p>Returns the <a href="qtable.html">QTable</a> the item belongs to.
<h3 class="fn"><a href="qstring.html">QString</a><a name="22eb16"></a>QTableItem::text()const <code>[virtual]</code></h3>
<p>Provides the text of the item.
<h3 class="fn">bool<a name="a0bb67"></a>QTableItem::wordWrap()const</h3>
<p>If word wrap has been turned on for the cell in question,
wordWrap() is TRUE, otherwise it returns FALSE.
<h3 class="fn">void<a name="6712c5"></a>QTableItem::updateEditor(intoldRow, intoldCol)</h3>
<p>For internal use only.
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright &copy; 1995-2001
<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  2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>