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

« back to all changes in this revision

Viewing changes to doc/html/qitemdelegate.html

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-11-02 18:30:08 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (15.2.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 88.
  • Revision ID: james.westby@ubuntu.com-20091102183008-b6a4gcs128mvfb3m
Tags: upstream-4.6.0~beta1
ImportĀ upstreamĀ versionĀ 4.6.0~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
<!DOCTYPE html
3
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
 
<!-- /fasttmp/mkdist-qt-4.5.2-1245473805/qt-x11-opensource-src-4.5.2/src/gui/itemviews/qitemdelegate.cpp -->
 
5
<!-- qitemdelegate.cpp -->
6
6
<head>
7
 
  <title>Qt 4.5: QItemDelegate Class Reference</title>
 
7
  <title>Qt 4.6: QItemDelegate Class Reference</title>
8
8
  <link href="classic.css" rel="stylesheet" type="text/css" />
9
9
</head>
10
10
<body>
 
11
<a name="//apple_ref/cpp/cl//QItemDelegate" />
11
12
<table border="0" cellpadding="0" cellspacing="0" width="100%">
12
13
<tr>
13
 
<td align="left" valign="top" width="32"><a href="http://qtsoftware.com/products/qt"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
14
 
<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="namespaces.html"><font color="#004faf">All&nbsp;Namespaces</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="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
15
 
<td align="right" valign="top" width="230"></td></tr></table><h1 class="title">QItemDelegate Class Reference<br /><span class="small-subtitle">[<a href="qtgui.html">QtGui</a> module]</span>
 
14
<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
 
15
<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="functions.html"><font color="#004faf">All&nbsp;Functions</font></a>&nbsp;&middot; <a href="overviews.html"><font color="#004faf">Overviews</font></a></td><td class="searchBar" align="right" valign="center"><form action="http://www.google.com/cse" id="cse-search-box"><div><input type="hidden" name="cx" value="000136343326384750312:dhbxnqlakyu" /><input type="hidden" name="ie" value="UTF-8" /><input type="text" name="q" size="31" /><input type="submit" name="sa" value="Search" /></div></form></td>
 
16
</tr></table><h1 class="title">QItemDelegate Class Reference<br /><span class="small-subtitle">[<a href="qtgui.html">QtGui</a> module]</span>
16
17
</h1>
17
18
<p>The QItemDelegate class provides display and editing facilities for data items from a model. <a href="#details">More...</a></p>
18
19
<pre> #include &lt;QItemDelegate&gt;</pre><p>Inherits <a href="qabstractitemdelegate.html">QAbstractItemDelegate</a>.</p>
20
21
<ul>
21
22
<li><a href="qitemdelegate-members.html">List of all members, including inherited members</a></li>
22
23
</ul>
 
24
<hr />
23
25
<a name="properties"></a>
24
 
<h3>Properties</h3>
25
 
<ul>
26
 
<li><div class="fn"></div><b><a href="qitemdelegate.html#clipping-prop">clipping</a></b> : bool</li>
27
 
</ul>
28
 
<ul>
29
 
<li><div class="fn"></div>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
30
 
</ul>
 
26
<h2>Properties</h2>
 
27
<ul>
 
28
<li><div class="fn"><b><a href="qitemdelegate.html#clipping-prop">clipping</a></b> : bool</div></li>
 
29
</ul>
 
30
<ul>
 
31
<li><div bar="2" class="fn"></div>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
 
32
</ul>
 
33
<hr />
31
34
<a name="public-functions"></a>
32
 
<h3>Public Functions</h3>
33
 
<ul>
34
 
<li><div class="fn"></div><b><a href="qitemdelegate.html#QItemDelegate">QItemDelegate</a></b> ( QObject * <i>parent</i> = 0 )</li>
35
 
<li><div class="fn"></div><b><a href="qitemdelegate.html#dtor.QItemDelegate">~QItemDelegate</a></b> ()</li>
36
 
<li><div class="fn"></div>virtual QWidget * <b><a href="qitemdelegate.html#createEditor">createEditor</a></b> ( QWidget * <i>parent</i>, const QStyleOptionViewItem &amp; <i>option</i>, const QModelIndex &amp; <i>index</i> ) const</li>
37
 
<li><div class="fn"></div>bool <b><a href="qitemdelegate.html#clipping-prop">hasClipping</a></b> () const</li>
38
 
<li><div class="fn"></div>QItemEditorFactory * <b><a href="qitemdelegate.html#itemEditorFactory">itemEditorFactory</a></b> () const</li>
39
 
<li><div class="fn"></div>virtual void <b><a href="qitemdelegate.html#paint">paint</a></b> ( QPainter * <i>painter</i>, const QStyleOptionViewItem &amp; <i>option</i>, const QModelIndex &amp; <i>index</i> ) const</li>
40
 
<li><div class="fn"></div>void <b><a href="qitemdelegate.html#clipping-prop">setClipping</a></b> ( bool <i>clip</i> )</li>
41
 
<li><div class="fn"></div>virtual void <b><a href="qitemdelegate.html#setEditorData">setEditorData</a></b> ( QWidget * <i>editor</i>, const QModelIndex &amp; <i>index</i> ) const</li>
42
 
<li><div class="fn"></div>void <b><a href="qitemdelegate.html#setItemEditorFactory">setItemEditorFactory</a></b> ( QItemEditorFactory * <i>factory</i> )</li>
43
 
<li><div class="fn"></div>virtual void <b><a href="qitemdelegate.html#setModelData">setModelData</a></b> ( QWidget * <i>editor</i>, QAbstractItemModel * <i>model</i>, const QModelIndex &amp; <i>index</i> ) const</li>
44
 
<li><div class="fn"></div>virtual QSize <b><a href="qitemdelegate.html#sizeHint">sizeHint</a></b> ( const QStyleOptionViewItem &amp; <i>option</i>, const QModelIndex &amp; <i>index</i> ) const</li>
45
 
<li><div class="fn"></div>virtual void <b><a href="qitemdelegate.html#updateEditorGeometry">updateEditorGeometry</a></b> ( QWidget * <i>editor</i>, const QStyleOptionViewItem &amp; <i>option</i>, const QModelIndex &amp; <i>index</i> ) const</li>
46
 
</ul>
47
 
<ul>
48
 
<li><div class="fn"></div>7 public functions inherited from <a href="qabstractitemdelegate.html#public-functions">QAbstractItemDelegate</a></li>
49
 
<li><div class="fn"></div>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
50
 
</ul>
 
35
<h2>Public Functions</h2>
 
36
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
 
37
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qitemdelegate.html#QItemDelegate">QItemDelegate</a></b> ( QObject * <i>parent</i> = 0 )</td></tr>
 
38
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qitemdelegate.html#dtor.QItemDelegate">~QItemDelegate</a></b> ()</td></tr>
 
39
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qitemdelegate.html#clipping-prop">hasClipping</a></b> () const</td></tr>
 
40
<tr><td class="memItemLeft" align="right" valign="top">QItemEditorFactory * </td><td class="memItemRight" valign="bottom"><b><a href="qitemdelegate.html#itemEditorFactory">itemEditorFactory</a></b> () const</td></tr>
 
41
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qitemdelegate.html#clipping-prop">setClipping</a></b> ( bool <i>clip</i> )</td></tr>
 
42
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qitemdelegate.html#setItemEditorFactory">setItemEditorFactory</a></b> ( QItemEditorFactory * <i>factory</i> )</td></tr>
 
43
</table>
 
44
<hr />
 
45
<a name="reimplemented-public-functions"></a>
 
46
<h2>Reimplemented Public Functions</h2>
 
47
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
 
48
<tr><td class="memItemLeft" align="right" valign="top">virtual QWidget * </td><td class="memItemRight" valign="bottom"><b><a href="qitemdelegate.html#createEditor">createEditor</a></b> ( QWidget * <i>parent</i>, const QStyleOptionViewItem &amp; <i>option</i>, const QModelIndex &amp; <i>index</i> ) const</td></tr>
 
49
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qitemdelegate.html#paint">paint</a></b> ( QPainter * <i>painter</i>, const QStyleOptionViewItem &amp; <i>option</i>, const QModelIndex &amp; <i>index</i> ) const</td></tr>
 
50
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qitemdelegate.html#setEditorData">setEditorData</a></b> ( QWidget * <i>editor</i>, const QModelIndex &amp; <i>index</i> ) const</td></tr>
 
51
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qitemdelegate.html#setModelData">setModelData</a></b> ( QWidget * <i>editor</i>, QAbstractItemModel * <i>model</i>, const QModelIndex &amp; <i>index</i> ) const</td></tr>
 
52
<tr><td class="memItemLeft" align="right" valign="top">virtual QSize </td><td class="memItemRight" valign="bottom"><b><a href="qitemdelegate.html#sizeHint">sizeHint</a></b> ( const QStyleOptionViewItem &amp; <i>option</i>, const QModelIndex &amp; <i>index</i> ) const</td></tr>
 
53
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qitemdelegate.html#updateEditorGeometry">updateEditorGeometry</a></b> ( QWidget * <i>editor</i>, const QStyleOptionViewItem &amp; <i>option</i>, const QModelIndex &amp; <i>index</i> ) const</td></tr>
 
54
</table>
 
55
<ul>
 
56
<li><div bar="2" class="fn"></div>7 public functions inherited from <a href="qabstractitemdelegate.html#public-functions">QAbstractItemDelegate</a></li>
 
57
<li><div bar="2" class="fn"></div>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
 
58
</ul>
 
59
<hr />
51
60
<a name="protected-functions"></a>
52
 
<h3>Protected Functions</h3>
53
 
<ul>
54
 
<li><div class="fn"></div>void <b><a href="qitemdelegate.html#drawBackground">drawBackground</a></b> ( QPainter * <i>painter</i>, const QStyleOptionViewItem &amp; <i>option</i>, const QModelIndex &amp; <i>index</i> ) const</li>
55
 
<li><div class="fn"></div>virtual void <b><a href="qitemdelegate.html#drawCheck">drawCheck</a></b> ( QPainter * <i>painter</i>, const QStyleOptionViewItem &amp; <i>option</i>, const QRect &amp; <i>rect</i>, Qt::CheckState <i>state</i> ) const</li>
56
 
<li><div class="fn"></div>virtual void <b><a href="qitemdelegate.html#drawDecoration">drawDecoration</a></b> ( QPainter * <i>painter</i>, const QStyleOptionViewItem &amp; <i>option</i>, const QRect &amp; <i>rect</i>, const QPixmap &amp; <i>pixmap</i> ) const</li>
57
 
<li><div class="fn"></div>virtual void <b><a href="qitemdelegate.html#drawDisplay">drawDisplay</a></b> ( QPainter * <i>painter</i>, const QStyleOptionViewItem &amp; <i>option</i>, const QRect &amp; <i>rect</i>, const QString &amp; <i>text</i> ) const</li>
58
 
<li><div class="fn"></div>virtual void <b><a href="qitemdelegate.html#drawFocus">drawFocus</a></b> ( QPainter * <i>painter</i>, const QStyleOptionViewItem &amp; <i>option</i>, const QRect &amp; <i>rect</i> ) const</li>
59
 
<li><div class="fn"></div>virtual bool <b><a href="qitemdelegate.html#eventFilter">eventFilter</a></b> ( QObject * <i>editor</i>, QEvent * <i>event</i> )</li>
60
 
</ul>
61
 
<ul>
62
 
<li><div class="fn"></div>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
 
61
<h2>Protected Functions</h2>
 
62
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
 
63
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qitemdelegate.html#drawBackground">drawBackground</a></b> ( QPainter * <i>painter</i>, const QStyleOptionViewItem &amp; <i>option</i>, const QModelIndex &amp; <i>index</i> ) const</td></tr>
 
64
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qitemdelegate.html#drawCheck">drawCheck</a></b> ( QPainter * <i>painter</i>, const QStyleOptionViewItem &amp; <i>option</i>, const QRect &amp; <i>rect</i>, Qt::CheckState <i>state</i> ) const</td></tr>
 
65
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qitemdelegate.html#drawDecoration">drawDecoration</a></b> ( QPainter * <i>painter</i>, const QStyleOptionViewItem &amp; <i>option</i>, const QRect &amp; <i>rect</i>, const QPixmap &amp; <i>pixmap</i> ) const</td></tr>
 
66
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qitemdelegate.html#drawDisplay">drawDisplay</a></b> ( QPainter * <i>painter</i>, const QStyleOptionViewItem &amp; <i>option</i>, const QRect &amp; <i>rect</i>, const QString &amp; <i>text</i> ) const</td></tr>
 
67
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qitemdelegate.html#drawFocus">drawFocus</a></b> ( QPainter * <i>painter</i>, const QStyleOptionViewItem &amp; <i>option</i>, const QRect &amp; <i>rect</i> ) const</td></tr>
 
68
</table>
 
69
<hr />
 
70
<a name="reimplemented-protected-functions"></a>
 
71
<h2>Reimplemented Protected Functions</h2>
 
72
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
 
73
<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qitemdelegate.html#editorEvent">editorEvent</a></b> ( QEvent * <i>event</i>, QAbstractItemModel * <i>model</i>, const QStyleOptionViewItem &amp; <i>option</i>, const QModelIndex &amp; <i>index</i> )</td></tr>
 
74
<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qitemdelegate.html#eventFilter">eventFilter</a></b> ( QObject * <i>editor</i>, QEvent * <i>event</i> )</td></tr>
 
75
</table>
 
76
<ul>
 
77
<li><div bar="2" class="fn"></div>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
63
78
</ul>
64
79
<h3>Additional Inherited Members</h3>
65
80
<ul>
89
104
<a name="standard-roles-and-data-types"></a>
90
105
<h3>Standard Roles and Data Types</h3>
91
106
<p>The default delegate used by the standard views supplied with Qt associates each standard role (defined by <a href="qt.html#ItemDataRole-enum">Qt::ItemDataRole</a>) with certain data types. Models that return data in these types can influence the appearance of the delegate as described in the following table.</p>
92
 
<p><table align="center" cellpadding="2" cellspacing="1" border="0">
 
107
<p><table class="generic" align="center" cellpadding="2" cellspacing="1" border="0">
93
108
<thead><tr valign="top" class="qt-style"><th>Role</th><th>Accepted Types</th></tr></thead>
94
109
<tr valign="top" class="odd"><td><a href="qt.html#ItemDataRole-enum">Qt::BackgroundRole</a></td><td><a href="qbrush.html">QBrush</a></td></tr>
95
110
<tr valign="top" class="even"><td><a href="qt.html#ItemDataRole-enum">Qt::BackgroundColorRole</a></td><td><a href="qcolor.html">QColor</a> (obsolete; use <a href="qt.html#ItemDataRole-enum">Qt::BackgroundRole</a> instead)</td></tr>
114
129
<p>See also <a href="model-view-delegate.html">Delegate Classes</a>, <a href="qstyleditemdelegate.html">QStyledItemDelegate</a>, <a href="qabstractitemdelegate.html">QAbstractItemDelegate</a>, <a href="itemviews-spinboxdelegate.html">Spin Box Delegate Example</a>, <a href="tools-settingseditor.html">Settings Editor Example</a>, and <a href="widgets-icons.html">Icons Example</a>.</p>
115
130
<hr />
116
131
<h2>Property Documentation</h2>
 
132
<a name="//apple_ref/cpp/instm/QItemDelegate/hasClipping" />
 
133
<a name="//apple_ref/cpp/instm/QItemDelegate/setClipping" />
117
134
<h3 class="fn"><a name="clipping-prop"></a>clipping : bool</h3>
118
135
<p>This property holds if the delegate should clip the paint events.</p>
119
136
<p>This property will set the paint clip to the size of the item. The default value is on. It is useful for cases such as when images are larger than the size of the item.</p>
120
137
<p>This property was introduced in Qt 4.2.</p>
121
 
<p>Access functions:</p>
122
 
<ul>
123
 
<li><div class="fn"></div><b>bool hasClipping () const</b></li>
124
 
<li><div class="fn"></div><b>void setClipping ( bool <i>clip</i> )</b></li>
125
 
</ul>
 
138
<p><b>Access functions:</b></p>
 
139
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
 
140
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b>hasClipping</b> () const</td></tr>
 
141
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b>setClipping</b> ( bool <i>clip</i> )</td></tr>
 
142
</table>
126
143
<hr />
127
144
<h2>Member Function Documentation</h2>
 
145
<a name="//apple_ref/cpp/instm/QItemDelegate/QItemDelegate" />
128
146
<h3 class="fn"><a name="QItemDelegate"></a>QItemDelegate::QItemDelegate ( <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
129
147
<p>Constructs an item delegate with the given <i>parent</i>.</p>
 
148
<a name="//apple_ref/cpp/instm/QItemDelegate/~QItemDelegate" />
130
149
<h3 class="fn"><a name="dtor.QItemDelegate"></a>QItemDelegate::~QItemDelegate ()</h3>
131
150
<p>Destroys the item delegate.</p>
 
151
<a name="//apple_ref/cpp/instm/QItemDelegate/createEditor" />
132
152
<h3 class="fn"><a name="createEditor"></a><a href="qwidget.html">QWidget</a> * QItemDelegate::createEditor ( <a href="qwidget.html">QWidget</a> * <i>parent</i>, const <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a> &amp; <i>option</i>, const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>index</i> ) const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
153
<p>Reimplemented from <a href="qabstractitemdelegate.html#createEditor">QAbstractItemDelegate::createEditor</a>().</p>
133
154
<p>Returns the widget used to edit the item specified by <i>index</i> for editing. The <i>parent</i> widget and style <i>option</i> are used to control how the editor widget appears.</p>
134
 
<p>Reimplemented from <a href="qabstractitemdelegate.html#createEditor">QAbstractItemDelegate</a>.</p>
135
155
<p>See also <a href="qabstractitemdelegate.html#createEditor">QAbstractItemDelegate::createEditor</a>().</p>
 
156
<a name="//apple_ref/cpp/instm/QItemDelegate/drawBackground" />
136
157
<h3 class="fn"><a name="drawBackground"></a>void QItemDelegate::drawBackground ( <a href="qpainter.html">QPainter</a> * <i>painter</i>, const <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a> &amp; <i>option</i>, const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>index</i> ) const&nbsp;&nbsp;<tt> [protected]</tt></h3>
137
158
<p>Renders the item background for the given <i>index</i>, using the given <i>painter</i> and style <i>option</i>.</p>
138
159
<p>This function was introduced in Qt 4.2.</p>
 
160
<a name="//apple_ref/cpp/instm/QItemDelegate/drawCheck" />
139
161
<h3 class="fn"><a name="drawCheck"></a>void QItemDelegate::drawCheck ( <a href="qpainter.html">QPainter</a> * <i>painter</i>, const <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a> &amp; <i>option</i>, const <a href="qrect.html">QRect</a> &amp; <i>rect</i>, <a href="qt.html#CheckState-enum">Qt::CheckState</a> <i>state</i> ) const&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
140
162
<p>Renders a check indicator within the rectangle specified by <i>rect</i>, using the given <i>painter</i> and style <i>option</i>, using the given <i>state</i>.</p>
 
163
<a name="//apple_ref/cpp/instm/QItemDelegate/drawDecoration" />
141
164
<h3 class="fn"><a name="drawDecoration"></a>void QItemDelegate::drawDecoration ( <a href="qpainter.html">QPainter</a> * <i>painter</i>, const <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a> &amp; <i>option</i>, const <a href="qrect.html">QRect</a> &amp; <i>rect</i>, const <a href="qpixmap.html">QPixmap</a> &amp; <i>pixmap</i> ) const&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
142
165
<p>Renders the decoration <i>pixmap</i> within the rectangle specified by <i>rect</i> using the given <i>painter</i> and style <i>option</i>.</p>
 
166
<a name="//apple_ref/cpp/instm/QItemDelegate/drawDisplay" />
143
167
<h3 class="fn"><a name="drawDisplay"></a>void QItemDelegate::drawDisplay ( <a href="qpainter.html">QPainter</a> * <i>painter</i>, const <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a> &amp; <i>option</i>, const <a href="qrect.html">QRect</a> &amp; <i>rect</i>, const <a href="qstring.html">QString</a> &amp; <i>text</i> ) const&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
144
168
<p>Renders the item view <i>text</i> within the rectangle specified by <i>rect</i> using the given <i>painter</i> and style <i>option</i>.</p>
 
169
<a name="//apple_ref/cpp/instm/QItemDelegate/drawFocus" />
145
170
<h3 class="fn"><a name="drawFocus"></a>void QItemDelegate::drawFocus ( <a href="qpainter.html">QPainter</a> * <i>painter</i>, const <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a> &amp; <i>option</i>, const <a href="qrect.html">QRect</a> &amp; <i>rect</i> ) const&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
146
171
<p>Renders the region within the rectangle specified by <i>rect</i>, indicating that it has the focus, using the given <i>painter</i> and style <i>option</i>.</p>
 
172
<a name="//apple_ref/cpp/instm/QItemDelegate/editorEvent" />
 
173
<h3 class="fn"><a name="editorEvent"></a>bool QItemDelegate::editorEvent ( <a href="qevent.html">QEvent</a> * <i>event</i>, <a href="qabstractitemmodel.html">QAbstractItemModel</a> * <i>model</i>, const <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a> &amp; <i>option</i>, const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>index</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
 
174
<p>Reimplemented from <a href="qabstractitemdelegate.html#editorEvent">QAbstractItemDelegate::editorEvent</a>().</p>
 
175
<a name="//apple_ref/cpp/instm/QItemDelegate/eventFilter" />
147
176
<h3 class="fn"><a name="eventFilter"></a>bool QItemDelegate::eventFilter ( <a href="qobject.html">QObject</a> * <i>editor</i>, <a href="qevent.html">QEvent</a> * <i>event</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
 
177
<p>Reimplemented from <a href="qobject.html#eventFilter">QObject::eventFilter</a>().</p>
148
178
<p>Returns true if the given <i>editor</i> is a valid <a href="qwidget.html">QWidget</a> and the given <i>event</i> is handled; otherwise returns false. The following key press events are handled by default:</p>
149
179
<ul>
150
180
<li><b>Tab</b></li>
155
185
</ul>
156
186
<p>In the case of <b>Tab</b>, <b>Backtab</b>, <b>Enter</b> and <b>Return</b> key press events, the <i>editor</i>'s data is comitted to the model and the editor is closed. If the <i>event</i> is a <b>Tab</b> key press the view will open an editor on the next item in the view. Likewise, if the <i>event</i> is a <b>Backtab</b> key press the view will open an editor on the <i>previous</i> item in the view.</p>
157
187
<p>If the event is a <b>Esc</b> key press event, the <i>editor</i> is closed <i>without</i> committing its data.</p>
158
 
<p>Reimplemented from <a href="qobject.html#eventFilter">QObject</a>.</p>
159
188
<p>See also <a href="qabstractitemdelegate.html#commitData">commitData</a>() and <a href="qabstractitemdelegate.html#closeEditor">closeEditor</a>().</p>
 
189
<a name="//apple_ref/cpp/instm/QItemDelegate/itemEditorFactory" />
160
190
<h3 class="fn"><a name="itemEditorFactory"></a><a href="qitemeditorfactory.html">QItemEditorFactory</a> * QItemDelegate::itemEditorFactory () const</h3>
161
191
<p>Returns the editor factory used by the item delegate. If no editor factory is set, the function will return null.</p>
162
192
<p>See also <a href="qitemdelegate.html#setItemEditorFactory">setItemEditorFactory</a>().</p>
 
193
<a name="//apple_ref/cpp/instm/QItemDelegate/paint" />
163
194
<h3 class="fn"><a name="paint"></a>void QItemDelegate::paint ( <a href="qpainter.html">QPainter</a> * <i>painter</i>, const <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a> &amp; <i>option</i>, const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>index</i> ) const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
195
<p>Reimplemented from <a href="qabstractitemdelegate.html#paint">QAbstractItemDelegate::paint</a>().</p>
164
196
<p>Renders the delegate using the given <i>painter</i> and style <i>option</i> for the item specified by <i>index</i>.</p>
165
197
<p>When reimplementing this function in a subclass, you should update the area held by the option's <a href="qstyleoption.html#rect-var">rect</a> variable, using the option's <a href="qstyleoption.html#state-var">state</a> variable to determine the state of the item to be displayed, and adjust the way it is painted accordingly.</p>
166
198
<p>For example, a selected item may need to be displayed differently to unselected items, as shown in the following code:</p>
181
213
     else
182
214
     ...</pre>
183
215
<p>After painting, you should ensure that the painter is returned to its the state it was supplied in when this function was called. For example, it may be useful to call <a href="qpainter.html#save">QPainter::save</a>() before painting and <a href="qpainter.html#restore">QPainter::restore</a>() afterwards.</p>
184
 
<p>Reimplemented from <a href="qabstractitemdelegate.html#paint">QAbstractItemDelegate</a>.</p>
185
216
<p>See also <a href="qstyle.html#StateFlag-enum">QStyle::State</a>.</p>
 
217
<a name="//apple_ref/cpp/instm/QItemDelegate/setEditorData" />
186
218
<h3 class="fn"><a name="setEditorData"></a>void QItemDelegate::setEditorData ( <a href="qwidget.html">QWidget</a> * <i>editor</i>, const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>index</i> ) const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
219
<p>Reimplemented from <a href="qabstractitemdelegate.html#setEditorData">QAbstractItemDelegate::setEditorData</a>().</p>
187
220
<p>Sets the data to be displayed and edited by the <i>editor</i> from the data model item specified by the model <i>index</i>.</p>
188
221
<p>The default implementation stores the data in the <i>editor</i> widget's <a href="properties.html">user property</a>.</p>
189
 
<p>Reimplemented from <a href="qabstractitemdelegate.html#setEditorData">QAbstractItemDelegate</a>.</p>
190
222
<p>See also <a href="qmetaproperty.html#isUser">QMetaProperty::isUser</a>().</p>
 
223
<a name="//apple_ref/cpp/instm/QItemDelegate/setItemEditorFactory" />
191
224
<h3 class="fn"><a name="setItemEditorFactory"></a>void QItemDelegate::setItemEditorFactory ( <a href="qitemeditorfactory.html">QItemEditorFactory</a> * <i>factory</i> )</h3>
192
225
<p>Sets the editor factory to be used by the item delegate to be the <i>factory</i> specified. If no editor factory is set, the item delegate will use the default editor factory.</p>
193
226
<p>See also <a href="qitemdelegate.html#itemEditorFactory">itemEditorFactory</a>().</p>
 
227
<a name="//apple_ref/cpp/instm/QItemDelegate/setModelData" />
194
228
<h3 class="fn"><a name="setModelData"></a>void QItemDelegate::setModelData ( <a href="qwidget.html">QWidget</a> * <i>editor</i>, <a href="qabstractitemmodel.html">QAbstractItemModel</a> * <i>model</i>, const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>index</i> ) const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
195
 
<p>Gets data drom the <i>editor</i> widget and stores it in the specified <i>model</i> at the item <i>index</i>.</p>
 
229
<p>Reimplemented from <a href="qabstractitemdelegate.html#setModelData">QAbstractItemDelegate::setModelData</a>().</p>
 
230
<p>Gets data from the <i>editor</i> widget and stores it in the specified <i>model</i> at the item <i>index</i>.</p>
196
231
<p>The default implementation gets the value to be stored in the data model from the <i>editor</i> widget's <a href="properties.html">user property</a>.</p>
197
 
<p>Reimplemented from <a href="qabstractitemdelegate.html#setModelData">QAbstractItemDelegate</a>.</p>
198
232
<p>See also <a href="qmetaproperty.html#isUser">QMetaProperty::isUser</a>().</p>
 
233
<a name="//apple_ref/cpp/instm/QItemDelegate/sizeHint" />
199
234
<h3 class="fn"><a name="sizeHint"></a><a href="qsize.html">QSize</a> QItemDelegate::sizeHint ( const <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a> &amp; <i>option</i>, const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>index</i> ) const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
235
<p>Reimplemented from <a href="qabstractitemdelegate.html#sizeHint">QAbstractItemDelegate::sizeHint</a>().</p>
200
236
<p>Returns the size needed by the delegate to display the item specified by <i>index</i>, taking into account the style information provided by <i>option</i>.</p>
201
237
<p>When reimplementing this function, note that in case of text items, <a href="qitemdelegate.html">QItemDelegate</a> adds a margin (i.e&#x2e; 2 * <a href="qstyle.html#PixelMetric-enum">QStyle::PM_FocusFrameHMargin</a>) to the length of the text.</p>
202
 
<p>Reimplemented from <a href="qabstractitemdelegate.html#sizeHint">QAbstractItemDelegate</a>.</p>
 
238
<a name="//apple_ref/cpp/instm/QItemDelegate/updateEditorGeometry" />
203
239
<h3 class="fn"><a name="updateEditorGeometry"></a>void QItemDelegate::updateEditorGeometry ( <a href="qwidget.html">QWidget</a> * <i>editor</i>, const <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a> &amp; <i>option</i>, const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>index</i> ) const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
240
<p>Reimplemented from <a href="qabstractitemdelegate.html#updateEditorGeometry">QAbstractItemDelegate::updateEditorGeometry</a>().</p>
204
241
<p>Updates the <i>editor</i> for the item specified by <i>index</i> according to the style <i>option</i> given.</p>
205
 
<p>Reimplemented from <a href="qabstractitemdelegate.html#updateEditorGeometry">QAbstractItemDelegate</a>.</p>
206
242
<p /><address><hr /><div align="center">
207
243
<table width="100%" cellspacing="0" border="0"><tr class="address">
208
 
<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
209
 
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
210
 
<td width="30%" align="right"><div align="right">Qt 4.5.2</div></td>
211
 
</tr></table></div></address></body>
 
244
<td width="40%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
 
245
<td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
246
<td width="40%" align="right"><div align="right">Qt 4.6.0</div></td>
 
247
<script type="text/javascript" src="http://www.google.com/jsapi"></script><script type="text/javascript">google.load("elements", "1", {packages: "transliteration"});</script><script type="text/javascript" src="http://www.google.com/coop/cse/t13n?form=cse-search-box&t13n_langs=en"></script><script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script></tr></table></div></address></body>
212
248
</html>