Sophie

Sophie

distrib > Mageia > 7 > armv7hl > by-pkgid > 1dd17e0d683ef79b4bb6872bbf359d7f > files > 4787

qt4-doc-4.8.7-26.2.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qabstractitemdelegate.cpp -->
  <title>Qt 4.8: QAbstractItemDelegate Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtgui.html">QtGui</a></li>
<li>QAbstractItemDelegate</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<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="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QAbstractItemDelegate Class Reference</h1>
<!-- $$$QAbstractItemDelegate-brief -->
<p>The QAbstractItemDelegate class is used to display and edit data items from a model. <a href="#details">More...</a></p>
<!-- @@@QAbstractItemDelegate -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QAbstractItemDelegate&gt;</span></pre><p><b>Inherits: </b><a href="qobject.html">QObject</a>.</p>
<p><b>Inherited by: </b><a href="qitemdelegate.html">QItemDelegate</a> and <a href="qstyleditemdelegate.html">QStyledItemDelegate</a>.</p>
<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>Public Types</h2>
<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>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<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> = 0 )</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 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 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>
<ul>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<a name="public-slots"></a>
<h2>Public Slots</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> 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>
</table>
<ul>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
</ul>
<a name="signals"></a>
<h2>Signals</h2>
<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>
<ul>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QAbstractItemDelegate-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QAbstractItemDelegate class is used to display and edit data items from a model.</p>
<p>A QAbstractItemDelegate 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 QAbstractItemDelegate class is one of the <a href="model-view.html">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 <tt>WidgetDelegate</tt> 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><a href="qabstractitemdelegate.html#paint">paint</a>(<span class="type"><a href="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="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="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="itemviews-pixelator.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"><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>
<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"><tt>QAbstractItemDelegate::NoHint</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">There is no recommended action to be performed.</td></tr>
</table>
<p>These hints let the delegate influence the behavior of the view:</p>
<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"><tt>QAbstractItemDelegate::EditNextItem</tt></td><td class="topAlign"><tt>1</tt></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"><tt>QAbstractItemDelegate::EditPreviousItem</tt></td><td class="topAlign"><tt>2</tt></td><td class="topAlign">The view should use the delegate to open an editor on the previous item in the view.</td></tr>
</table>
<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>
<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"><tt>QAbstractItemDelegate::SubmitModelCache</tt></td><td class="topAlign"><tt>3</tt></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"><tt>QAbstractItemDelegate::RevertModelCache</tt></td><td class="topAlign"><tt>4</tt></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>
<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"><a name="QAbstractItemDelegate"></a>QAbstractItemDelegate::<span class="name">QAbstractItemDelegate</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>parent</i> = 0 )</h3>
<p>Creates a new abstract item delegate with the given <i>parent</i>.</p>
<!-- @@@QAbstractItemDelegate -->
<!-- $$$~QAbstractItemDelegate[overload1]$$$~QAbstractItemDelegate -->
<h3 class="fn"><a name="dtor.QAbstractItemDelegate"></a>QAbstractItemDelegate::<span class="name">~QAbstractItemDelegate</span> ()<tt> [virtual]</tt></h3>
<p>Destroys the abstract item delegate.</p>
<!-- @@@~QAbstractItemDelegate -->
<!-- $$$closeEditor[overload1]$$$closeEditorQWidget*QAbstractItemDelegate::EndEditHint -->
<h3 class="fn"><a name="closeEditor"></a><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 )<tt> [signal]</tt></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 <tt>EditNextItem</tt> 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"><a name="commitData"></a><span class="type">void</span> QAbstractItemDelegate::<span class="name">commitData</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>editor</i> )<tt> [signal]</tt></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"><a name="createEditor"></a><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="qmodelindex.html">QModelIndex</a></span> &amp; <i>index</i> ) const<tt> [virtual]</tt></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 0. If you want custom editing you will need to reimplement this function.</p>
<p>The returned editor widget should have <a href="qt.html#FocusPolicy-enum">Qt::StrongFocus</a>; otherwise, <a href="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#setModelData">setModelData</a>() and <a href="qabstractitemdelegate.html#setEditorData">setEditorData</a>().</p>
<!-- @@@createEditor -->
<!-- $$$editorEvent[overload1]$$$editorEventQEvent*QAbstractItemModel*constQStyleOptionViewItem&constQModelIndex& -->
<h3 class="fn"><a name="editorEvent"></a><span class="type">bool</span> QAbstractItemDelegate::<span class="name">editorEvent</span> ( <span class="type"><a href="qevent.html">QEvent</a></span> * <i>event</i>, <span class="type"><a href="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="qmodelindex.html">QModelIndex</a></span> &amp; <i>index</i> )<tt> [virtual]</tt></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 false (indicating that it has not handled the event).</p>
<!-- @@@editorEvent -->
<!-- $$$helpEvent[overload1]$$$helpEventQHelpEvent*QAbstractItemView*constQStyleOptionViewItem&constQModelIndex& -->
<h3 class="fn"><a name="helpEvent"></a><span class="type">bool</span> QAbstractItemDelegate::<span class="name">helpEvent</span> ( <span class="type"><a href="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="qmodelindex.html">QModelIndex</a></span> &amp; <i>index</i> )<tt> [slot]</tt></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 true if the delegate can handle the event; otherwise returns false. A return value of true indicates that the data obtained using the index had the required role.</p>
<p>For <a href="qevent.html#Type-enum">QEvent::ToolTip</a> and <a href="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="qhelpevent.html">QHelpEvent</a>.</p>
<!-- @@@helpEvent -->
<!-- $$$paint[overload1]$$$paintQPainter*constQStyleOptionViewItem&constQModelIndex& -->
<h3 class="fn"><a name="paint"></a><span class="type">void</span> QAbstractItemDelegate::<span class="name">paint</span> ( <span class="type"><a href="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="qmodelindex.html">QModelIndex</a></span> &amp; <i>index</i> ) const<tt> [pure virtual]</tt></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"><a name="setEditorData"></a><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="qmodelindex.html">QModelIndex</a></span> &amp; <i>index</i> ) const<tt> [virtual]</tt></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"><a name="setModelData"></a><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="qabstractitemmodel.html">QAbstractItemModel</a></span> * <i>model</i>, const <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> &amp; <i>index</i> ) const<tt> [virtual]</tt></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"><a name="sizeHint"></a><span class="type"><a href="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="qmodelindex.html">QModelIndex</a></span> &amp; <i>index</i> ) const<tt> [pure virtual]</tt></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"><a name="sizeHintChanged"></a><span class="type">void</span> QAbstractItemDelegate::<span class="name">sizeHintChanged</span> ( const <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> &amp; <i>index</i> )<tt> [signal]</tt></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"><a name="updateEditorGeometry"></a><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="qmodelindex.html">QModelIndex</a></span> &amp; <i>index</i> ) const<tt> [virtual]</tt></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 class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
      Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      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.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      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. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
  </div>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>