~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/q3tableitem.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/qt3support/itemviews/q3table.cpp -->
 
6
<head>
 
7
    <title>Qt 4.0: Q3TableItem Class Reference</title>
 
8
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
 
9
a:link { color: #004faf; text-decoration: none }
 
10
a:visited { color: #672967; text-decoration: none }
 
11
td.postheader { font-family: sans-serif }
 
12
tr.address { font-family: sans-serif }
 
13
body { background: #ffffff; color: black; }</style>
 
14
</head>
 
15
<body>
 
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
17
<tr>
 
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
19
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
 
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">Q3TableItem Class Reference</h1>
 
21
<p>The Q3TableItem class provides the cell content for <a href="q3table.html">Q3Table</a> cells. <a href="#details">More...</a></p>
 
22
<pre>#include &lt;Q3TableItem&gt;</pre><p><b>This class is part of the Qt 3 support library.</b> It is provided to keep old source code working. We strongly advise against using it in new code. See the <a href="porting4.html">Porting Guide</a> for more information.</p>
 
23
<p>Part of the <a href="qt3support.html">Qt3Support</a> module.</p>
 
24
<p>Inherited by <a href="q3checktableitem.html">Q3CheckTableItem</a> and <a href="q3combotableitem.html">Q3ComboTableItem</a>.</p>
 
25
<ul>
 
26
<li><a href="q3tableitem-members.html">List of all members, including inherited members</a></li>
 
27
</ul>
 
28
<a name="public-types"></a>
 
29
<h3>Public Types</h3>
 
30
<ul>
 
31
<li><div class="fn"/>enum <b><a href="q3tableitem.html#EditType-enum">EditType</a></b> { Always, WhenCurrent, OnTyping, Never }</li>
 
32
</ul>
 
33
<a name="public-functions"></a>
 
34
<h3>Public Functions</h3>
 
35
<ul>
 
36
<li><div class="fn"/><b><a href="q3tableitem.html#Q3TableItem">Q3TableItem</a></b> ( Q3Table * <i>table</i>, EditType <i>et</i> )</li>
 
37
<li><div class="fn"/><b><a href="q3tableitem.html#Q3TableItem-2">Q3TableItem</a></b> ( Q3Table * <i>table</i>, EditType <i>et</i>, const QString &amp; <i>text</i> )</li>
 
38
<li><div class="fn"/><b><a href="q3tableitem.html#Q3TableItem-3">Q3TableItem</a></b> ( Q3Table * <i>table</i>, EditType <i>et</i>, const QString &amp; <i>text</i>, const QPixmap &amp; <i>p</i> )</li>
 
39
<li><div class="fn"/>virtual <b><a href="q3tableitem.html#dtor.Q3TableItem">~Q3TableItem</a></b> ()</li>
 
40
<li><div class="fn"/>virtual int <b><a href="q3tableitem.html#alignment">alignment</a></b> () const</li>
 
41
<li><div class="fn"/>int <b><a href="q3tableitem.html#col">col</a></b> () const</li>
 
42
<li><div class="fn"/>int <b><a href="q3tableitem.html#colSpan">colSpan</a></b> () const</li>
 
43
<li><div class="fn"/>virtual QWidget * <b><a href="q3tableitem.html#createEditor">createEditor</a></b> () const</li>
 
44
<li><div class="fn"/>EditType <b><a href="q3tableitem.html#editType">editType</a></b> () const</li>
 
45
<li><div class="fn"/>bool <b><a href="q3tableitem.html#isEnabled">isEnabled</a></b> () const</li>
 
46
<li><div class="fn"/>bool <b><a href="q3tableitem.html#isReplaceable">isReplaceable</a></b> () const</li>
 
47
<li><div class="fn"/>virtual QString <b><a href="q3tableitem.html#key">key</a></b> () const</li>
 
48
<li><div class="fn"/>virtual void <b><a href="q3tableitem.html#paint">paint</a></b> ( QPainter * <i>p</i>, const QColorGroup &amp; <i>cg</i>, const QRect &amp; <i>cr</i>, bool <i>selected</i> )</li>
 
49
<li><div class="fn"/>virtual QPixmap <b><a href="q3tableitem.html#pixmap">pixmap</a></b> () const</li>
 
50
<li><div class="fn"/>int <b><a href="q3tableitem.html#row">row</a></b> () const</li>
 
51
<li><div class="fn"/>int <b><a href="q3tableitem.html#rowSpan">rowSpan</a></b> () const</li>
 
52
<li><div class="fn"/>virtual int <b><a href="q3tableitem.html#rtti">rtti</a></b> () const</li>
 
53
<li><div class="fn"/>virtual void <b><a href="q3tableitem.html#setCol">setCol</a></b> ( int <i>c</i> )</li>
 
54
<li><div class="fn"/>virtual void <b><a href="q3tableitem.html#setContentFromEditor">setContentFromEditor</a></b> ( QWidget * <i>w</i> )</li>
 
55
<li><div class="fn"/>virtual void <b><a href="q3tableitem.html#setEnabled">setEnabled</a></b> ( bool <i>b</i> )</li>
 
56
<li><div class="fn"/>virtual void <b><a href="q3tableitem.html#setPixmap">setPixmap</a></b> ( const QPixmap &amp; <i>p</i> )</li>
 
57
<li><div class="fn"/>virtual void <b><a href="q3tableitem.html#setReplaceable">setReplaceable</a></b> ( bool <i>b</i> )</li>
 
58
<li><div class="fn"/>virtual void <b><a href="q3tableitem.html#setRow">setRow</a></b> ( int <i>r</i> )</li>
 
59
<li><div class="fn"/>virtual void <b><a href="q3tableitem.html#setSpan">setSpan</a></b> ( int <i>rs</i>, int <i>cs</i> )</li>
 
60
<li><div class="fn"/>virtual void <b><a href="q3tableitem.html#setText">setText</a></b> ( const QString &amp; <i>str</i> )</li>
 
61
<li><div class="fn"/>virtual void <b><a href="q3tableitem.html#setWordWrap">setWordWrap</a></b> ( bool <i>b</i> )</li>
 
62
<li><div class="fn"/>virtual QSize <b><a href="q3tableitem.html#sizeHint">sizeHint</a></b> () const</li>
 
63
<li><div class="fn"/>Q3Table * <b><a href="q3tableitem.html#table">table</a></b> () const</li>
 
64
<li><div class="fn"/>virtual QString <b><a href="q3tableitem.html#text">text</a></b> () const</li>
 
65
<li><div class="fn"/>bool <b><a href="q3tableitem.html#wordWrap">wordWrap</a></b> () const</li>
 
66
</ul>
 
67
<a name="details"></a>
 
68
<hr />
 
69
<h2>Detailed Description</h2>
 
70
<p>The Q3TableItem class provides the cell content for <a href="q3table.html">Q3Table</a> cells.</p>
 
71
<p>For many applications Q3TableItems are ideal for presenting and editing the contents of <a href="q3table.html">Q3Table</a> cells. In situations where you need to create very large tables you may prefer an alternative approach to using Q3TableItems: see the notes on large tables.</p>
 
72
<p>A Q3TableItem contains a cell's data, by default, a string and a pixmap. The table item also holds the cell's display size and how the data should be aligned. The table item specifies the cell's <a href="q3tableitem.html#EditType-enum">EditType</a> and the editor used for in-place editing (by default a <a href="qlineedit.html">QLineEdit</a>). If you want checkboxes use <a href="q3checktableitem.html">Q3CheckTableItem</a>, and if you want comboboxes use <a href="q3combotableitem.html">Q3ComboTableItem</a>. The <a href="q3tableitem.html#EditType-enum">EditType</a> (set in the constructor) determines whether the cell's contents may be edited.</p>
 
73
<p>If a pixmap is specified it is displayed to the left of any text. You can change the text or pixmap with <a href="q3tableitem.html#setText">setText</a>() and <a href="q3tableitem.html#setPixmap">setPixmap</a>() respectively. For text you can use <a href="q3tableitem.html#setWordWrap">setWordWrap</a>().</p>
 
74
<p>When sorting table items the <a href="q3tableitem.html#key">key</a>() function is used; by default this returns the table item's <a href="q3tableitem.html#text">text</a>(). Reimplement <a href="q3tableitem.html#key">key</a>() to customize how your table items will sort.</p>
 
75
<p>Table items are inserted into a table using <a href="q3table.html#setItem">Q3Table::setItem</a>(). If you insert an item into a cell that already contains a table item the original item will be deleted.</p>
 
76
<p>Example:</p>
 
77
<pre>&nbsp;   for (int row = 0; row &lt; table-&gt;numRows(); row++) {
 
78
        for (int col = 0; col &lt; table-&gt;numCols(); col++) {
 
79
            table-&gt;setItem(row, col,
 
80
                new Q3TableItem(table, Q3TableItem::WhenCurrent, QString::number(row * col)));
 
81
        }
 
82
    }</pre>
 
83
<p>You can move a table item from one cell to another, in the same or a different table, using <a href="q3table.html#takeItem">Q3Table::takeItem</a>() and <a href="q3table.html#setItem">Q3Table::setItem</a>() but see also <a href="q3table.html#swapCells">Q3Table::swapCells</a>().</p>
 
84
<p>Table items can be deleted with delete in the standard way; the table and cell will be updated accordingly.</p>
 
85
<p>Note, that if you have a table item that is not currently in a table then anything you do to that item other than insert it into a table will result in undefined behaviour.</p>
 
86
<p>Reimplement <a href="q3tableitem.html#createEditor">createEditor</a>() and <a href="q3tableitem.html#setContentFromEditor">setContentFromEditor</a>() if you want to use your own widget instead of a <a href="qlineedit.html">QLineEdit</a> for editing cell contents. Reimplement <a href="q3tableitem.html#paint">paint</a>() if you want to display custom content.</p>
 
87
<p>It is important to ensure that your custom widget can accept the keyboard focus, so that the user can use the tab key to navigate the table as normal. Therefore, if the widget returned by <a href="q3tableitem.html#createEditor">createEditor</a>() does not itself accept the keyboard focus, it is necessary to nominate a child widget to do so on its behalf. For example, a <a href="porting4.html#qhbox">QHBox</a> with two child <a href="qlineedit.html">QLineEdit</a> widgets may use one of them to accept the keyboard focus:</p>
 
88
<pre>&nbsp;   QWidget* MyTableItem::createEditor() const
 
89
    {
 
90
        QHBox* hbox = new QHBox(table()-&gt;viewport());
 
91
        hbox-&gt;setFocusProxy(new QLineEdit(hbox));
 
92
        new QLineEdit(hbox);
 
93
        return hbox;
 
94
    }</pre>
 
95
<p>By default, table items may be replaced by new Q3TableItems during the lifetime of a <a href="q3table.html">Q3Table</a>. Therefore, if you create your own subclass of Q3TableItem, and you want to ensure that this does not happen, you must call setReplaceable(false) in the constructor of your subclass.</p>
 
96
<center><img src="images/qtableitems.png" alt="Table Items" /></center><p>See also <a href="q3checktableitem.html">Q3CheckTableItem</a> and <a href="q3combotableitem.html">Q3ComboTableItem</a>.</p>
 
97
<hr />
 
98
<h2>Member Type Documentation</h2>
 
99
<h3 class="fn"><a name="EditType-enum"></a>enum Q3TableItem::EditType</h3>
 
100
<a name="wheneditable"></a><p>This enum is used to define whether a cell is editable or read-only (in conjunction with other settings), and how the cell should be displayed.</p>
 
101
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
102
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
103
<tr><td valign="top"><tt>Q3TableItem::Always</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">The cell always <i>looks</i> editable.</td></tr>
 
104
</table>
 
105
<p>Using this EditType ensures that the editor created with <a href="q3tableitem.html#createEditor">createEditor</a>() (by default a <a href="qlineedit.html">QLineEdit</a>) is always visible. This has implications for the alignment of the content: the default editor aligns everything (even numbers) to the left whilst numerical values in the cell are by default aligned to the right.</p>
 
106
<p>If a cell with the edit type <tt>Always</tt> looks misaligned you could reimplement <a href="q3tableitem.html#createEditor">createEditor</a>() for these items.</p>
 
107
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
108
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
109
<tr><td valign="top"><tt>Q3TableItem::WhenCurrent</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">The cell <i>looks</i> editable only when it has keyboard focus (see <a href="q3table.html#setCurrentCell">Q3Table::setCurrentCell</a>()).</td></tr>
 
110
<tr><td valign="top"><tt>Q3TableItem::OnTyping</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">The cell <i>looks</i> editable only when the user types in it or double-clicks it. It resembles the <tt>WhenCurrent</tt> functionality but is, perhaps, nicer.</td></tr>
 
111
</table>
 
112
<p>The <tt>OnTyping</tt> edit type is the default when <a href="q3tableitem.html">Q3TableItem</a> objects are created by the convenience functions <a href="q3table.html#setText">Q3Table::setText</a>() and <a href="q3table.html#setPixmap">Q3Table::setPixmap</a>().</p>
 
113
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
114
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
115
<tr><td valign="top"><tt>Q3TableItem::Never</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">The cell is not editable.</td></tr>
 
116
</table>
 
117
<p>The cell is actually editable only if <a href="q3table.html#isRowReadOnly">Q3Table::isRowReadOnly</a>() is false for its row, <a href="q3table.html#isColumnReadOnly">Q3Table::isColumnReadOnly</a>() is false for its column, and <a href="q3table.html#readOnly-prop">Q3Table::isReadOnly</a>() is false.</p>
 
118
<p>Q3ComboTableItems have an isEditable() property. This property is used to indicate whether the user may enter their own text or are restricted to choosing one of the choices in the list. Q3ComboTableItems may be interacted with only if they are editable in accordance with their EditType as described above.</p>
 
119
<hr />
 
120
<h2>Member Function Documentation</h2>
 
121
<h3 class="fn"><a name="Q3TableItem"></a>Q3TableItem::Q3TableItem ( <a href="q3table.html">Q3Table</a> * <i>table</i>, <a href="q3tableitem.html#EditType-enum">EditType</a> <i>et</i> )</h3>
 
122
<p>Creates a table item that is a child of table <i>table</i> with no text. The item has the <a href="q3tableitem.html#EditType-enum">EditType</a> <i>et</i>.</p>
 
123
<p>The table item will use a <a href="qlineedit.html">QLineEdit</a> for its editor, will not word-wrap and will occupy a single cell. Insert the table item into a table with <a href="q3table.html#setItem">Q3Table::setItem</a>().</p>
 
124
<p>The table takes ownership of the table item, so a table item should not be inserted into more than one table at a time.</p>
 
125
<h3 class="fn"><a name="Q3TableItem-2"></a>Q3TableItem::Q3TableItem ( <a href="q3table.html">Q3Table</a> * <i>table</i>, <a href="q3tableitem.html#EditType-enum">EditType</a> <i>et</i>, const <a href="qstring.html">QString</a> &amp; <i>text</i> )</h3>
 
126
<p>Creates a table item that is a child of table <i>table</i> with text <i>text</i>. The item has the <a href="q3tableitem.html#EditType-enum">EditType</a> <i>et</i>.</p>
 
127
<p>The table item will use a <a href="qlineedit.html">QLineEdit</a> for its editor, will not word-wrap and will occupy a single cell. Insert the table item into a table with <a href="q3table.html#setItem">Q3Table::setItem</a>().</p>
 
128
<p>The table takes ownership of the table item, so a table item should not be inserted into more than one table at a time.</p>
 
129
<h3 class="fn"><a name="Q3TableItem-3"></a>Q3TableItem::Q3TableItem ( <a href="q3table.html">Q3Table</a> * <i>table</i>, <a href="q3tableitem.html#EditType-enum">EditType</a> <i>et</i>, const <a href="qstring.html">QString</a> &amp; <i>text</i>, const <a href="qpixmap.html">QPixmap</a> &amp; <i>p</i> )</h3>
 
130
<p>Creates a table item that is a child of table <i>table</i> with text <i>text</i> and pixmap <i>p</i>. The item has the <a href="q3tableitem.html#EditType-enum">EditType</a> <i>et</i>.</p>
 
131
<p>The table item will display the pixmap to the left of the text. It will use a <a href="qlineedit.html">QLineEdit</a> for editing the text, will not word-wrap and will occupy a single cell. Insert the table item into a table with <a href="q3table.html#setItem">Q3Table::setItem</a>().</p>
 
132
<p>The table takes ownership of the table item, so a table item should not be inserted in more than one table at a time.</p>
 
133
<h3 class="fn"><a name="dtor.Q3TableItem"></a>Q3TableItem::~Q3TableItem ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
134
<p>The destructor deletes this item and frees all allocated resources.</p>
 
135
<p>If the table item is in a table (i.e. was inserted with setItem()), it will be removed from the table and the cell it occupied.</p>
 
136
<h3 class="fn"><a name="alignment"></a>int Q3TableItem::alignment () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
137
<p>The alignment function returns how the text contents of the cell are aligned when drawn. The default implementation aligns numbers to the right and any other text to the left.</p>
 
138
<p>See also <a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a>.</p>
 
139
<h3 class="fn"><a name="col"></a>int Q3TableItem::col () const</h3>
 
140
<p>Returns the column where the table item is located. If the cell spans multiple columns, this function returns the left-most column.</p>
 
141
<p>See also <a href="q3tableitem.html#row">row</a>() and <a href="q3tableitem.html#setCol">setCol</a>().</p>
 
142
<h3 class="fn"><a name="colSpan"></a>int Q3TableItem::colSpan () const</h3>
 
143
<p>Returns the column span of the table item, usually 1.</p>
 
144
<p>See also <a href="q3tableitem.html#setSpan">setSpan</a>() and <a href="q3tableitem.html#rowSpan">rowSpan</a>().</p>
 
145
<h3 class="fn"><a name="createEditor"></a><a href="qwidget.html">QWidget</a> * Q3TableItem::createEditor () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
146
<p>This virtual function creates an editor which the user can interact with to edit the cell's contents. The default implementation creates a <a href="qlineedit.html">QLineEdit</a>.</p>
 
147
<p>If the function returns 0, the cell is read-only.</p>
 
148
<p>The returned widget should preferably be invisible, ideally with <a href="q3scrollview.html#viewport">Q3Table::viewport</a>() as parent.</p>
 
149
<p>If you reimplement this function you'll almost certainly need to reimplement <a href="q3tableitem.html#setContentFromEditor">setContentFromEditor</a>(), and may need to reimplement <a href="q3tableitem.html#sizeHint">sizeHint</a>().</p>
 
150
<p>See also <a href="q3table.html#createEditor">Q3Table::createEditor</a>(), <a href="q3tableitem.html#setContentFromEditor">setContentFromEditor</a>(), <a href="q3scrollview.html#viewport">Q3Table::viewport</a>(), and <a href="q3tableitem.html#setReplaceable">setReplaceable</a>().</p>
 
151
<h3 class="fn"><a name="editType"></a><a href="q3tableitem.html#EditType-enum">EditType</a> Q3TableItem::editType () const</h3>
 
152
<p>Returns the table item's edit type.</p>
 
153
<p>This is set when the table item is constructed.</p>
 
154
<p>See also <a href="q3tableitem.html#EditType-enum">EditType</a> and <a href="q3tableitem.html#Q3TableItem">Q3TableItem</a>().</p>
 
155
<h3 class="fn"><a name="isEnabled"></a>bool Q3TableItem::isEnabled () const</h3>
 
156
<p>Returns true if the table item is enabled; otherwise returns false.</p>
 
157
<p>See also <a href="q3tableitem.html#setEnabled">setEnabled</a>().</p>
 
158
<h3 class="fn"><a name="isReplaceable"></a>bool Q3TableItem::isReplaceable () const</h3>
 
159
<p>This function returns whether the contents of the cell may be replaced with the contents of another table item. Regardless of this setting, table items that span more than one cell may not have their contents replaced by another table item.</p>
 
160
<p>(This differs from <a href="q3tableitem.html#EditType-enum">EditType</a> because <a href="q3tableitem.html#EditType-enum">EditType</a> is concerned with whether the <i>user</i> is able to change the contents of a cell.)</p>
 
161
<p>See also <a href="q3tableitem.html#setReplaceable">setReplaceable</a>() and <a href="q3tableitem.html#EditType-enum">EditType</a>.</p>
 
162
<h3 class="fn"><a name="key"></a><a href="qstring.html">QString</a> Q3TableItem::key () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
163
<p>This virtual function returns the key that should be used for sorting. The default implementation returns the <a href="q3tableitem.html#text">text</a>() of the relevant item.</p>
 
164
<p>See also <a href="q3table.html#sorting-prop">Q3Table::setSorting</a>().</p>
 
165
<h3 class="fn"><a name="paint"></a>void Q3TableItem::paint ( <a href="qpainter.html">QPainter</a> * <i>p</i>, const <a href="qcolorgroup.html">QColorGroup</a> &amp; <i>cg</i>, const <a href="qrect.html">QRect</a> &amp; <i>cr</i>, bool <i>selected</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
166
<p>This virtual function is used to paint the contents of an item using the painter <i>p</i> in the rectangular area <i>cr</i> using the color group <i>cg</i>.</p>
 
167
<p>If <i>selected</i> is true the cell is displayed in a way that indicates that it is highlighted.</p>
 
168
<p>You don't usually need to use this function but if you want to draw custom content in a cell you will need to reimplement it.</p>
 
169
<p>The painter passed to this function is translated so that 0, 0 is the top-left corner of the item that is being painted.</p>
 
170
<p>Note that the painter is not clipped by default in order to get maximum efficiency. If you want clipping, use</p>
 
171
<pre>&nbsp;   p-&gt;setClipRect(table()-&gt;cellRect(row, col), QPainter::ClipPainter);
 
172
    //... your drawing code
 
173
    p-&gt;setClipping(false);</pre>
 
174
<h3 class="fn"><a name="pixmap"></a><a href="qpixmap.html">QPixmap</a> Q3TableItem::pixmap () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
175
<p>Returns the table item's pixmap or a null pixmap if no pixmap has been set.</p>
 
176
<p>See also <a href="q3tableitem.html#setPixmap">setPixmap</a>() and <a href="q3tableitem.html#text">text</a>().</p>
 
177
<h3 class="fn"><a name="row"></a>int Q3TableItem::row () const</h3>
 
178
<p>Returns the row where the table item is located. If the cell spans multiple rows, this function returns the top-most row.</p>
 
179
<p>See also <a href="q3tableitem.html#col">col</a>() and <a href="q3tableitem.html#setRow">setRow</a>().</p>
 
180
<h3 class="fn"><a name="rowSpan"></a>int Q3TableItem::rowSpan () const</h3>
 
181
<p>Returns the row span of the table item, usually 1.</p>
 
182
<p>See also <a href="q3tableitem.html#setSpan">setSpan</a>() and <a href="q3tableitem.html#colSpan">colSpan</a>().</p>
 
183
<h3 class="fn"><a name="rtti"></a>int Q3TableItem::rtti () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
184
<p>Returns the Run Time Type Identification value for this table item which for Q3TableItems is 0.</p>
 
185
<p>When you create subclasses based on <a href="q3tableitem.html">Q3TableItem</a> make sure that each subclass returns a unique rtti() value. It is advisable to use values greater than 1000, preferably large random numbers, to allow for extensions to this class.</p>
 
186
<p>See also <a href="q3checktableitem.html#rtti">Q3CheckTableItem::rtti</a>() and <a href="q3combotableitem.html#rtti">Q3ComboTableItem::rtti</a>().</p>
 
187
<h3 class="fn"><a name="setCol"></a>void Q3TableItem::setCol ( int <i>c</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
188
<p>Sets column <i>c</i> as the table item's column. Usually you will not need to call this function.</p>
 
189
<p>If the cell spans multiple columns, this function sets the left-most column and retains the width of the multi-cell table item.</p>
 
190
<p>See also <a href="q3tableitem.html#col">col</a>(), <a href="q3tableitem.html#setRow">setRow</a>(), and <a href="q3tableitem.html#colSpan">colSpan</a>().</p>
 
191
<h3 class="fn"><a name="setContentFromEditor"></a>void Q3TableItem::setContentFromEditor ( <a href="qwidget.html">QWidget</a> * <i>w</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
192
<p>Whenever the content of a cell has been edited by the editor <i>w</i>, <a href="q3table.html">Q3Table</a> calls this virtual function to copy the new values into the <a href="q3tableitem.html">Q3TableItem</a>.</p>
 
193
<p>If you reimplement <a href="q3tableitem.html#createEditor">createEditor</a>() and return something that is not a <a href="qlineedit.html">QLineEdit</a> you will need to reimplement this function.</p>
 
194
<p>See also <a href="q3table.html#setCellContentFromEditor">Q3Table::setCellContentFromEditor</a>().</p>
 
195
<h3 class="fn"><a name="setEnabled"></a>void Q3TableItem::setEnabled ( bool <i>b</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
196
<p>If <i>b</i> is true, the table item is enabled; if <i>b</i> is false the table item is disabled.</p>
 
197
<p>A disabled item doesn't respond to user interaction.</p>
 
198
<p>See also <a href="q3tableitem.html#isEnabled">isEnabled</a>().</p>
 
199
<h3 class="fn"><a name="setPixmap"></a>void Q3TableItem::setPixmap ( const <a href="qpixmap.html">QPixmap</a> &amp; <i>p</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
200
<p>Sets pixmap <i>p</i> to be this item's pixmap.</p>
 
201
<p>Note that setPixmap() does not update the cell the table item belongs to. Use <a href="q3table.html#updateCell">Q3Table::updateCell</a>() to repaint the cell's contents.</p>
 
202
<p>For <a href="q3combotableitem.html">Q3ComboTableItem</a>s and <a href="q3checktableitem.html">Q3CheckTableItem</a>s this function has no visible effect.</p>
 
203
<p>See also <a href="q3table.html#setPixmap">Q3Table::setPixmap</a>(), <a href="q3tableitem.html#pixmap">pixmap</a>(), and <a href="q3tableitem.html#setText">setText</a>().</p>
 
204
<h3 class="fn"><a name="setReplaceable"></a>void Q3TableItem::setReplaceable ( bool <i>b</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
205
<p>If <i>b</i> is true it is acceptable to replace the contents of the cell with the contents of another <a href="q3tableitem.html">Q3TableItem</a>. If <i>b</i> is false the contents of the cell may not be replaced by the contents of another table item. Table items that span more than one cell may not have their contents replaced by another table item.</p>
 
206
<p>(This differs from <a href="q3tableitem.html#EditType-enum">EditType</a> because <a href="q3tableitem.html#EditType-enum">EditType</a> is concerned with whether the <i>user</i> is able to change the contents of a cell.)</p>
 
207
<p>See also <a href="q3tableitem.html#isReplaceable">isReplaceable</a>().</p>
 
208
<h3 class="fn"><a name="setRow"></a>void Q3TableItem::setRow ( int <i>r</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
209
<p>Sets row <i>r</i> as the table item's row. Usually you do not need to call this function.</p>
 
210
<p>If the cell spans multiple rows, this function sets the top row and retains the height of the multi-cell table item.</p>
 
211
<p>See also <a href="q3tableitem.html#row">row</a>(), <a href="q3tableitem.html#setCol">setCol</a>(), and <a href="q3tableitem.html#rowSpan">rowSpan</a>().</p>
 
212
<h3 class="fn"><a name="setSpan"></a>void Q3TableItem::setSpan ( int <i>rs</i>, int <i>cs</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
213
<p>Changes the extent of the <a href="q3tableitem.html">Q3TableItem</a> so that it spans multiple cells covering <i>rs</i> rows and <i>cs</i> columns. The top left cell is the original cell.</p>
 
214
<p><b>Warning:</b> This function only works if the item has already been inserted into the table using e.g. <a href="q3table.html#setItem">Q3Table::setItem</a>(). This function also checks to make sure if <i>rs</i> and <i>cs</i> are within the bounds of the table and returns without changing the span if they are not. In addition swapping, inserting or removing rows and columns that cross Q3TableItems spanning more than one cell is not supported.</p>
 
215
<p>See also <a href="q3tableitem.html#rowSpan">rowSpan</a>() and <a href="q3tableitem.html#colSpan">colSpan</a>().</p>
 
216
<h3 class="fn"><a name="setText"></a>void Q3TableItem::setText ( const <a href="qstring.html">QString</a> &amp; <i>str</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
217
<p>Changes the table item's text to <i>str</i>.</p>
 
218
<p>Note that setText() does not update the cell the table item belongs to. Use <a href="q3table.html#updateCell">Q3Table::updateCell</a>() to repaint the cell's contents.</p>
 
219
<p>See also <a href="q3table.html#setText">Q3Table::setText</a>(), <a href="q3tableitem.html#text">text</a>(), <a href="q3tableitem.html#setPixmap">setPixmap</a>(), and <a href="q3table.html#updateCell">Q3Table::updateCell</a>().</p>
 
220
<h3 class="fn"><a name="setWordWrap"></a>void Q3TableItem::setWordWrap ( bool <i>b</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
221
<p>If <i>b</i> is true, the cell's text will be wrapped over multiple lines, when necessary, to fit the width of the cell; otherwise the text will be written as a single line.</p>
 
222
<p>See also <a href="q3tableitem.html#wordWrap">wordWrap</a>(), <a href="q3table.html#adjustColumn">Q3Table::adjustColumn</a>(), and <a href="q3table.html#setColumnStretchable">Q3Table::setColumnStretchable</a>().</p>
 
223
<h3 class="fn"><a name="sizeHint"></a><a href="qsize.html">QSize</a> Q3TableItem::sizeHint () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
224
<p>This virtual function returns the size a cell needs to show its entire content.</p>
 
225
<p>If you subclass <a href="q3tableitem.html">Q3TableItem</a> you will often need to reimplement this function.</p>
 
226
<h3 class="fn"><a name="table"></a><a href="q3table.html">Q3Table</a> * Q3TableItem::table () const</h3>
 
227
<p>Returns the <a href="q3table.html">Q3Table</a> the table item belongs to.</p>
 
228
<p>See also <a href="q3table.html#setItem">Q3Table::setItem</a>() and <a href="q3tableitem.html#Q3TableItem">Q3TableItem</a>().</p>
 
229
<h3 class="fn"><a name="text"></a><a href="qstring.html">QString</a> Q3TableItem::text () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
230
<p>Returns the text of the table item or an empty string if there is no text.</p>
 
231
<p>To ensure that the current value of the editor is returned, <a href="q3tableitem.html#setContentFromEditor">setContentFromEditor</a>() is called:</p>
 
232
<ol type="1">
 
233
<li>if the editMode() is <tt>Always</tt>, or</li>
 
234
<li>if editMode() is <i>not</i> <tt>Always</tt> but the editor of the cell is active and the editor is not a <a href="qlineedit.html">QLineEdit</a>.</li>
 
235
</ol>
 
236
<p>This means that text() returns the original text value of the item if the editor is a line edit, until the user commits an edit (e.g. by pressing Enter or Tab) in which case the new text is returned. For other editors (e.g. a combobox) <a href="q3tableitem.html#setContentFromEditor">setContentFromEditor</a>() is always called so the currently display value is the one returned.</p>
 
237
<p>See also <a href="q3tableitem.html#setText">setText</a>() and <a href="q3tableitem.html#pixmap">pixmap</a>().</p>
 
238
<h3 class="fn"><a name="wordWrap"></a>bool Q3TableItem::wordWrap () const</h3>
 
239
<p>Returns true if word wrap is enabled for the cell; otherwise returns false.</p>
 
240
<p>See also <a href="q3tableitem.html#setWordWrap">setWordWrap</a>().</p>
 
241
<p /><address><hr /><div align="center">
 
242
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
243
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
244
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
245
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
246
</tr></table></div></address></body>
 
247
</html>