Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-updates > by-pkgid > d5e62c01ae8d1e579463c6a871dd44bf > files > 3653

qtbase5-doc-5.12.6-2.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qabstractitemdelegate.cpp -->
  <title>QAbstractItemDelegate Class | Qt Widgets 5.12.6</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.12</td><td ><a href="qtwidgets-index.html">Qt Widgets</a></td><td ><a href="qtwidgets-module.html">C++ Classes</a></td><td >QAbstractItemDelegate</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtwidgets-index.html">Qt 5.12.6 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QAbstractItemDelegate Class</h1>
<!-- $$$QAbstractItemDelegate-brief -->
<p>The <a href="qabstractitemdelegate.html">QAbstractItemDelegate</a> class is used to display and edit data items from a model. <a href="#details">More...</a></p>
<!-- @@@QAbstractItemDelegate -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QAbstractItemDelegate&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += widgets</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="../qtcore/qobject.html">QObject</a></td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherited By:</td><td class="memItemRight bottomAlign"> <p><a href="qitemdelegate.html">QItemDelegate</a> and <a href="qstyleditemdelegate.html">QStyledItemDelegate</a></p>
</td></tr></table></div><ul>
<li><a href="qabstractitemdelegate-members.html">List of all members, including inherited members</a></li>
<li><a href="qabstractitemdelegate-obsolete.html">Obsolete members</a></li>
</ul>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qabstractitemdelegate.html#EndEditHint-enum">EndEditHint</a></b> { NoHint, EditNextItem, EditPreviousItem, SubmitModelCache, RevertModelCache }</td></tr>
</table></div>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qabstractitemdelegate.html#QAbstractItemDelegate">QAbstractItemDelegate</a></b>(QObject *<i>parent</i> = nullptr)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qabstractitemdelegate.html#dtor.QAbstractItemDelegate">~QAbstractItemDelegate</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QWidget *</td><td class="memItemRight bottomAlign"><b><a href="qabstractitemdelegate.html#createEditor">createEditor</a></b>(QWidget *<i>parent</i>, const QStyleOptionViewItem &amp;<i>option</i>, const QModelIndex &amp;<i>index</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractitemdelegate.html#destroyEditor">destroyEditor</a></b>(QWidget *<i>editor</i>, const QModelIndex &amp;<i>index</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qabstractitemdelegate.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>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qabstractitemdelegate.html#helpEvent">helpEvent</a></b>(QHelpEvent *<i>event</i>, QAbstractItemView *<i>view</i>, const QStyleOptionViewItem &amp;<i>option</i>, const QModelIndex &amp;<i>index</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractitemdelegate.html#paint">paint</a></b>(QPainter *<i>painter</i>, const QStyleOptionViewItem &amp;<i>option</i>, const QModelIndex &amp;<i>index</i>) const = 0</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractitemdelegate.html#setEditorData">setEditorData</a></b>(QWidget *<i>editor</i>, const QModelIndex &amp;<i>index</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractitemdelegate.html#setModelData">setModelData</a></b>(QWidget *<i>editor</i>, QAbstractItemModel *<i>model</i>, const QModelIndex &amp;<i>index</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QSize </td><td class="memItemRight bottomAlign"><b><a href="qabstractitemdelegate.html#sizeHint">sizeHint</a></b>(const QStyleOptionViewItem &amp;<i>option</i>, const QModelIndex &amp;<i>index</i>) const = 0</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractitemdelegate.html#updateEditorGeometry">updateEditorGeometry</a></b>(QWidget *<i>editor</i>, const QStyleOptionViewItem &amp;<i>option</i>, const QModelIndex &amp;<i>index</i>) const</td></tr>
</table></div>
<ul>
<li class="fn">31 public functions inherited from <a href="../qtcore/qobject.html#public-functions">QObject</a></li>
</ul>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractitemdelegate.html#closeEditor">closeEditor</a></b>(QWidget *<i>editor</i>, QAbstractItemDelegate::EndEditHint <i>hint</i> = NoHint)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractitemdelegate.html#commitData">commitData</a></b>(QWidget *<i>editor</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractitemdelegate.html#sizeHintChanged">sizeHintChanged</a></b>(const QModelIndex &amp;<i>index</i>)</td></tr>
</table></div>
<ul>
<li class="fn">2 signals inherited from <a href="../qtcore/qobject.html#signals">QObject</a></li>
</ul>
<a name="static-public-members"></a>
<h2 id="static-public-members">Static Public Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> const QMetaObject </td><td class="memItemRight bottomAlign"><b><a href="qabstractitemdelegate.html#staticMetaObject-var">staticMetaObject</a></b></td></tr>
</table></div>
<ul>
<li class="fn">9 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 property inherited from <a href="../qtcore/qobject.html#properties">QObject</a></li>
<li class="fn">1 public slot inherited from <a href="../qtcore/qobject.html#public-slots">QObject</a></li>
<li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QAbstractItemDelegate-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qabstractitemdelegate.html">QAbstractItemDelegate</a> class is used to display and edit data items from a model.</p>
<p>A <a href="qabstractitemdelegate.html">QAbstractItemDelegate</a> provides the interface and common functionality for delegates in the model/view architecture. Delegates display individual items in views, and handle the editing of model data.</p>
<p>The <a href="qabstractitemdelegate.html">QAbstractItemDelegate</a> class is one of the <a href="model-view-programming.html#model-view-classes">Model/View Classes</a> and is part of Qt's <a href="model-view-programming.html">model/view framework</a>.</p>
<p>To render an item in a custom way, you must implement <a href="qabstractitemdelegate.html#paint">paint</a>() and <a href="qabstractitemdelegate.html#sizeHint">sizeHint</a>(). The <a href="qitemdelegate.html">QItemDelegate</a> class provides default implementations for these functions; if you do not need custom rendering, subclass that class instead.</p>
<p>We give an example of drawing a progress bar in items; in our case for a package management program.</p>
<p class="centerAlign"><img src="images/widgetdelegate.png" alt="" /></p><p>We create the <code>WidgetDelegate</code> class, which inherits from <a href="qstyleditemdelegate.html">QStyledItemDelegate</a>. We do the drawing in the <a href="qabstractitemdelegate.html#paint">paint</a>() function:</p>
<pre class="cpp">

  <span class="type">void</span> WidgetDelegate<span class="operator">::</span>paint(<span class="type"><a href="../qtgui/qpainter.html">QPainter</a></span> <span class="operator">*</span>painter<span class="operator">,</span> <span class="keyword">const</span> <span class="type"><a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a></span> <span class="operator">&amp;</span>option<span class="operator">,</span>
                             <span class="keyword">const</span> <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> <span class="operator">&amp;</span>index) <span class="keyword">const</span>
  {
      <span class="keyword">if</span> (index<span class="operator">.</span>column() <span class="operator">=</span><span class="operator">=</span> <span class="number">1</span>) {
          <span class="type">int</span> progress <span class="operator">=</span> index<span class="operator">.</span>data()<span class="operator">.</span>toInt();

          <span class="type"><a href="qstyleoptionprogressbar.html">QStyleOptionProgressBar</a></span> progressBarOption;
          progressBarOption<span class="operator">.</span>rect <span class="operator">=</span> option<span class="operator">.</span>rect;
          progressBarOption<span class="operator">.</span>minimum <span class="operator">=</span> <span class="number">0</span>;
          progressBarOption<span class="operator">.</span>maximum <span class="operator">=</span> <span class="number">100</span>;
          progressBarOption<span class="operator">.</span>progress <span class="operator">=</span> progress;
          progressBarOption<span class="operator">.</span>text <span class="operator">=</span> <span class="type"><a href="../qtcore/qstring.html">QString</a></span><span class="operator">::</span>number(progress) <span class="operator">+</span> <span class="string">&quot;%&quot;</span>;
          progressBarOption<span class="operator">.</span>textVisible <span class="operator">=</span> <span class="keyword">true</span>;

          <span class="type"><a href="qapplication.html">QApplication</a></span><span class="operator">::</span>style()<span class="operator">-</span><span class="operator">&gt;</span>drawControl(<span class="type"><a href="qstyle.html">QStyle</a></span><span class="operator">::</span>CE_ProgressBar<span class="operator">,</span>
                                             <span class="operator">&amp;</span>progressBarOption<span class="operator">,</span> painter);
      } <span class="keyword">else</span>
          <span class="type"><a href="qstyleditemdelegate.html">QStyledItemDelegate</a></span><span class="operator">::</span>paint(painter<span class="operator">,</span> option<span class="operator">,</span> index);

</pre>
<p>Notice that we use a <a href="qstyleoptionprogressbar.html">QStyleOptionProgressBar</a> and initialize its members. We can then use the current <a href="qstyle.html">QStyle</a> to draw it.</p>
<p>To provide custom editing, there are two approaches that can be used. The first approach is to create an editor widget and display it directly on top of the item. To do this you must reimplement <a href="qabstractitemdelegate.html#createEditor">createEditor</a>() to provide an editor widget, <a href="qabstractitemdelegate.html#setEditorData">setEditorData</a>() to populate the editor with the data from the model, and <a href="qabstractitemdelegate.html#setModelData">setModelData</a>() so that the delegate can update the model with data from the editor.</p>
<p>The second approach is to handle user events directly by reimplementing <a href="qabstractitemdelegate.html#editorEvent">editorEvent</a>().</p>
</div>
<p><b>See also </b><a href="model-view-programming.html">Model/View Programming</a>, <a href="qitemdelegate.html">QItemDelegate</a>, <a href="qtwidgets-itemviews-pixelator-example.html">Pixelator Example</a>, <a href="qstyleditemdelegate.html">QStyledItemDelegate</a>, and <a href="qstyle.html">QStyle</a>.</p>
<!-- @@@QAbstractItemDelegate -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$EndEditHint$$$NoHint$$$EditNextItem$$$EditPreviousItem$$$SubmitModelCache$$$RevertModelCache -->
<h3 class="fn" id="EndEditHint-enum"><a name="EndEditHint-enum"></a>enum QAbstractItemDelegate::<span class="name">EndEditHint</span></h3>
<p>This enum describes the different hints that the delegate can give to the model and view components to make editing data in a model a comfortable experience for the user.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QAbstractItemDelegate::NoHint</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">There is no recommended action to be performed.</td></tr>
</table></div>
<p>These hints let the delegate influence the behavior of the view:</p>
<div class="table"><table class="valuelist"><tr valign="top" class="even"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QAbstractItemDelegate::EditNextItem</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The view should use the delegate to open an editor on the next item in the view.</td></tr>
<tr><td class="topAlign"><code>QAbstractItemDelegate::EditPreviousItem</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">The view should use the delegate to open an editor on the previous item in the view.</td></tr>
</table></div>
<p>Note that custom views may interpret the concepts of next and previous differently.</p>
<p>The following hints are most useful when models are used that cache data, such as those that manipulate data locally in order to increase performance or conserve network bandwidth.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QAbstractItemDelegate::SubmitModelCache</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">If the model caches data, it should write out cached data to the underlying data store.</td></tr>
<tr><td class="topAlign"><code>QAbstractItemDelegate::RevertModelCache</code></td><td class="topAlign tblval"><code>4</code></td><td class="topAlign">If the model caches data, it should discard cached data and replace it with data from the underlying data store.</td></tr>
</table></div>
<p>Although models and views should respond to these hints in appropriate ways, custom components may ignore any or all of them if they are not relevant.</p>
<!-- @@@EndEditHint -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QAbstractItemDelegate[overload1]$$$QAbstractItemDelegateQObject* -->
<h3 class="fn" id="QAbstractItemDelegate"><a name="QAbstractItemDelegate"></a>QAbstractItemDelegate::<span class="name">QAbstractItemDelegate</span>(<span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>parent</i> = nullptr)</h3>
<p>Creates a new abstract item delegate with the given <i>parent</i>.</p>
<!-- @@@QAbstractItemDelegate -->
<!-- $$$~QAbstractItemDelegate[overload1]$$$~QAbstractItemDelegate -->
<h3 class="fn" id="dtor.QAbstractItemDelegate"><a name="dtor.QAbstractItemDelegate"></a><code>[virtual] </code>QAbstractItemDelegate::<span class="name">~QAbstractItemDelegate</span>()</h3>
<p>Destroys the abstract item delegate.</p>
<!-- @@@~QAbstractItemDelegate -->
<!-- $$$closeEditor[overload1]$$$closeEditorQWidget*QAbstractItemDelegate::EndEditHint -->
<h3 class="fn" id="closeEditor"><a name="closeEditor"></a><code>[signal] </code><span class="type">void</span> QAbstractItemDelegate::<span class="name">closeEditor</span>(<span class="type"><a href="qwidget.html">QWidget</a></span> *<i>editor</i>, <span class="type"><a href="qabstractitemdelegate.html#EndEditHint-enum">QAbstractItemDelegate::EndEditHint</a></span> <i>hint</i> = NoHint)</h3>
<p>This signal is emitted when the user has finished editing an item using the specified <i>editor</i>.</p>
<p>The <i>hint</i> provides a way for the delegate to influence how the model and view behave after editing is completed. It indicates to these components what action should be performed next to provide a comfortable editing experience for the user. For example, if <code>EditNextItem</code> is specified, the view should use a delegate to open an editor on the next item in the model.</p>
<p><b>See also </b><a href="qabstractitemdelegate.html#EndEditHint-enum">EndEditHint</a>.</p>
<!-- @@@closeEditor -->
<!-- $$$commitData[overload1]$$$commitDataQWidget* -->
<h3 class="fn" id="commitData"><a name="commitData"></a><code>[signal] </code><span class="type">void</span> QAbstractItemDelegate::<span class="name">commitData</span>(<span class="type"><a href="qwidget.html">QWidget</a></span> *<i>editor</i>)</h3>
<p>This signal must be emitted when the <i>editor</i> widget has completed editing the data, and wants to write it back into the model.</p>
<!-- @@@commitData -->
<!-- $$$createEditor[overload1]$$$createEditorQWidget*constQStyleOptionViewItem&constQModelIndex& -->
<h3 class="fn" id="createEditor"><a name="createEditor"></a><code>[virtual] </code><span class="type"><a href="qwidget.html">QWidget</a></span> *QAbstractItemDelegate::<span class="name">createEditor</span>(<span class="type"><a href="qwidget.html">QWidget</a></span> *<i>parent</i>, const <span class="type"><a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a></span> &amp;<i>option</i>, const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>Returns the editor to be used for editing the data item with the given <i>index</i>. Note that the index contains information about the model being used. The editor's parent widget is specified by <i>parent</i>, and the item options by <i>option</i>.</p>
<p>The base implementation returns <code>nullptr</code>. If you want custom editing you will need to reimplement this function.</p>
<p>The returned editor widget should have <a href="../qtcore/qt.html#FocusPolicy-enum">Qt::StrongFocus</a>; otherwise, <a href="../qtgui/qmouseevent.html">QMouseEvent</a>s received by the widget will propagate to the view. The view's background will shine through unless the editor paints its own background (e.g&#x2e;, with <a href="qwidget.html#autoFillBackground-prop">setAutoFillBackground()</a>).</p>
<p><b>See also </b><a href="qabstractitemdelegate.html#destroyEditor">destroyEditor</a>(), <a href="qabstractitemdelegate.html#setModelData">setModelData</a>(), and <a href="qabstractitemdelegate.html#setEditorData">setEditorData</a>().</p>
<!-- @@@createEditor -->
<!-- $$$destroyEditor[overload1]$$$destroyEditorQWidget*constQModelIndex& -->
<h3 class="fn" id="destroyEditor"><a name="destroyEditor"></a><code>[virtual] </code><span class="type">void</span> QAbstractItemDelegate::<span class="name">destroyEditor</span>(<span class="type"><a href="qwidget.html">QWidget</a></span> *<i>editor</i>, const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>Called when the <i>editor</i> is no longer needed for editing the data item with the given <i>index</i> and should be destroyed. The default behavior is a call to <a href="../qtcore/qobject.html#deleteLater">deleteLater</a> on the editor. It is possible e.g&#x2e; to avoid this delete by reimplementing this function.</p>
<p>This function was introduced in  Qt 5.0.</p>
<p><b>See also </b><a href="qabstractitemdelegate.html#createEditor">createEditor</a>().</p>
<!-- @@@destroyEditor -->
<!-- $$$editorEvent[overload1]$$$editorEventQEvent*QAbstractItemModel*constQStyleOptionViewItem&constQModelIndex& -->
<h3 class="fn" id="editorEvent"><a name="editorEvent"></a><code>[virtual] </code><span class="type">bool</span> QAbstractItemDelegate::<span class="name">editorEvent</span>(<span class="type"><a href="../qtcore/qevent.html">QEvent</a></span> *<i>event</i>, <span class="type"><a href="../qtcore/qabstractitemmodel.html">QAbstractItemModel</a></span> *<i>model</i>, const <span class="type"><a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a></span> &amp;<i>option</i>, const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>)</h3>
<p>When editing of an item starts, this function is called with the <i>event</i> that triggered the editing, the <i>model</i>, the <i>index</i> of the item, and the <i>option</i> used for rendering the item.</p>
<p>Mouse events are sent to editorEvent() even if they don't start editing of the item. This can, for instance, be useful if you wish to open a context menu when the right mouse button is pressed on an item.</p>
<p>The base implementation returns <code>false</code> (indicating that it has not handled the event).</p>
<!-- @@@editorEvent -->
<!-- $$$helpEvent[overload1]$$$helpEventQHelpEvent*QAbstractItemView*constQStyleOptionViewItem&constQModelIndex& -->
<h3 class="fn" id="helpEvent"><a name="helpEvent"></a><code>[virtual] </code><span class="type">bool</span> QAbstractItemDelegate::<span class="name">helpEvent</span>(<span class="type"><a href="../qtgui/qhelpevent.html">QHelpEvent</a></span> *<i>event</i>, <span class="type"><a href="qabstractitemview.html">QAbstractItemView</a></span> *<i>view</i>, const <span class="type"><a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a></span> &amp;<i>option</i>, const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>)</h3>
<p>Whenever a help event occurs, this function is called with the <i>event</i> <i>view</i> <i>option</i> and the <i>index</i> that corresponds to the item where the event occurs.</p>
<p>Returns <code>true</code> if the delegate can handle the event; otherwise returns <code>false</code>. A return value of true indicates that the data obtained using the index had the required role.</p>
<p>For <a href="../qtcore/qevent.html#Type-enum">QEvent::ToolTip</a> and <a href="../qtcore/qevent.html#Type-enum">QEvent::WhatsThis</a> events that were handled successfully, the relevant popup may be shown depending on the user's system configuration.</p>
<p>This function was introduced in  Qt 4.3.</p>
<p><b>See also </b><a href="../qtgui/qhelpevent.html">QHelpEvent</a>.</p>
<!-- @@@helpEvent -->
<!-- $$$paint[overload1]$$$paintQPainter*constQStyleOptionViewItem&constQModelIndex& -->
<h3 class="fn" id="paint"><a name="paint"></a><code>[pure virtual] </code><span class="type">void</span> QAbstractItemDelegate::<span class="name">paint</span>(<span class="type"><a href="../qtgui/qpainter.html">QPainter</a></span> *<i>painter</i>, const <span class="type"><a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a></span> &amp;<i>option</i>, const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>This pure abstract function must be reimplemented if you want to provide custom rendering. Use the <i>painter</i> and style <i>option</i> to render the item specified by the item <i>index</i>.</p>
<p>If you reimplement this you must also reimplement <a href="qabstractitemdelegate.html#sizeHint">sizeHint</a>().</p>
<!-- @@@paint -->
<!-- $$$setEditorData[overload1]$$$setEditorDataQWidget*constQModelIndex& -->
<h3 class="fn" id="setEditorData"><a name="setEditorData"></a><code>[virtual] </code><span class="type">void</span> QAbstractItemDelegate::<span class="name">setEditorData</span>(<span class="type"><a href="qwidget.html">QWidget</a></span> *<i>editor</i>, const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>Sets the contents of the given <i>editor</i> to the data for the item at the given <i>index</i>. Note that the index contains information about the model being used.</p>
<p>The base implementation does nothing. If you want custom editing you will need to reimplement this function.</p>
<p><b>See also </b><a href="qabstractitemdelegate.html#setModelData">setModelData</a>().</p>
<!-- @@@setEditorData -->
<!-- $$$setModelData[overload1]$$$setModelDataQWidget*QAbstractItemModel*constQModelIndex& -->
<h3 class="fn" id="setModelData"><a name="setModelData"></a><code>[virtual] </code><span class="type">void</span> QAbstractItemDelegate::<span class="name">setModelData</span>(<span class="type"><a href="qwidget.html">QWidget</a></span> *<i>editor</i>, <span class="type"><a href="../qtcore/qabstractitemmodel.html">QAbstractItemModel</a></span> *<i>model</i>, const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>Sets the data for the item at the given <i>index</i> in the <i>model</i> to the contents of the given <i>editor</i>.</p>
<p>The base implementation does nothing. If you want custom editing you will need to reimplement this function.</p>
<p><b>See also </b><a href="qabstractitemdelegate.html#setEditorData">setEditorData</a>().</p>
<!-- @@@setModelData -->
<!-- $$$sizeHint[overload1]$$$sizeHintconstQStyleOptionViewItem&constQModelIndex& -->
<h3 class="fn" id="sizeHint"><a name="sizeHint"></a><code>[pure virtual] </code><span class="type"><a href="../qtcore/qsize.html">QSize</a></span> QAbstractItemDelegate::<span class="name">sizeHint</span>(const <span class="type"><a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a></span> &amp;<i>option</i>, const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>This pure abstract function must be reimplemented if you want to provide custom rendering. The options are specified by <i>option</i> and the model item by <i>index</i>.</p>
<p>If you reimplement this you must also reimplement <a href="qabstractitemdelegate.html#paint">paint</a>().</p>
<!-- @@@sizeHint -->
<!-- $$$sizeHintChanged[overload1]$$$sizeHintChangedconstQModelIndex& -->
<h3 class="fn" id="sizeHintChanged"><a name="sizeHintChanged"></a><code>[signal] </code><span class="type">void</span> QAbstractItemDelegate::<span class="name">sizeHintChanged</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>)</h3>
<p>This signal must be emitted when the <a href="qabstractitemdelegate.html#sizeHint">sizeHint</a>() of <i>index</i> changed.</p>
<p>Views automatically connect to this signal and relayout items as necessary.</p>
<p>This function was introduced in  Qt 4.4.</p>
<!-- @@@sizeHintChanged -->
<!-- $$$updateEditorGeometry[overload1]$$$updateEditorGeometryQWidget*constQStyleOptionViewItem&constQModelIndex& -->
<h3 class="fn" id="updateEditorGeometry"><a name="updateEditorGeometry"></a><code>[virtual] </code><span class="type">void</span> QAbstractItemDelegate::<span class="name">updateEditorGeometry</span>(<span class="type"><a href="qwidget.html">QWidget</a></span> *<i>editor</i>, const <span class="type"><a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a></span> &amp;<i>option</i>, const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>Updates the geometry of the <i>editor</i> for the item with the given <i>index</i>, according to the rectangle specified in the <i>option</i>. If the item has an internal layout, the editor will be laid out accordingly. Note that the index contains information about the model being used.</p>
<p>The base implementation does nothing. If you want custom editing you must reimplement this function.</p>
<!-- @@@updateEditorGeometry -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>