Sophie

Sophie

distrib > Fedora > 18 > x86_64 > by-pkgid > ff187cb994c94c614ecc64c5a8528b1b > files > 6490

qt-doc-4.8.5-10.fc18.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" />
<!-- qstyleditemdelegate.cpp -->
  <title>Qt 4.8: QStyledItemDelegate 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>QStyledItemDelegate</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-functions">Public Functions</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#subclassing-qstyleditemdelegate">Subclassing QStyledItemDelegate</a></li>
<li class="level2"><a href="#qstyleditemdelegate-vs-qitemdelegate">QStyledItemDelegate vs. QItemDelegate</a></li>
</ul>
</div>
<h1 class="title">QStyledItemDelegate Class Reference</h1>
<!-- $$$QStyledItemDelegate-brief -->
<p>The QStyledItemDelegate class provides display and editing facilities for data items from a model. <a href="#details">More...</a></p>
<!-- @@@QStyledItemDelegate -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QStyledItemDelegate&gt;</span></pre><p><b>Inherits: </b><a href="qabstractitemdelegate.html">QAbstractItemDelegate</a>.</p>
<p>This class was introduced in Qt 4.4.</p>
<ul>
<li><a href="qstyleditemdelegate-members.html">List of all members, including inherited members</a></li>
</ul>
<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="qstyleditemdelegate.html#QStyledItemDelegate">QStyledItemDelegate</a></b> ( QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstyleditemdelegate.html#dtor.QStyledItemDelegate">~QStyledItemDelegate</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QString </td><td class="memItemRight bottomAlign"><b><a href="qstyleditemdelegate.html#displayText">displayText</a></b> ( const QVariant &amp; <i>value</i>, const QLocale &amp; <i>locale</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QItemEditorFactory * </td><td class="memItemRight bottomAlign"><b><a href="qstyleditemdelegate.html#itemEditorFactory">itemEditorFactory</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstyleditemdelegate.html#setItemEditorFactory">setItemEditorFactory</a></b> ( QItemEditorFactory * <i>factory</i> )</td></tr>
</table>
<a name="reimplemented-public-functions"></a>
<h2>Reimplemented Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual QWidget * </td><td class="memItemRight bottomAlign"><b><a href="qstyleditemdelegate.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="qstyleditemdelegate.html#paint">paint</a></b> ( QPainter * <i>painter</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="qstyleditemdelegate.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="qstyleditemdelegate.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="qstyleditemdelegate.html#sizeHint">sizeHint</a></b> ( 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="qstyleditemdelegate.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">7 public functions inherited from <a href="qabstractitemdelegate.html#public-functions">QAbstractItemDelegate</a></li>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<a name="protected-functions"></a>
<h2>Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qstyleditemdelegate.html#initStyleOption">initStyleOption</a></b> ( QStyleOptionViewItem * <i>option</i>, const QModelIndex &amp; <i>index</i> ) const</td></tr>
</table>
<a name="reimplemented-protected-functions"></a>
<h2>Reimplemented Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qstyleditemdelegate.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="qstyleditemdelegate.html#eventFilter">eventFilter</a></b> ( QObject * <i>editor</i>, QEvent * <i>event</i> )</td></tr>
</table>
<ul>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">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">1 public slot inherited from <a href="qabstractitemdelegate.html#public-slots">QAbstractItemDelegate</a></li>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li class="fn">3 signals inherited from <a href="qabstractitemdelegate.html#signals">QAbstractItemDelegate</a></li>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QStyledItemDelegate-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QStyledItemDelegate class provides display and editing facilities for data items from a model.</p>
<p>When displaying data from models in Qt item views, e.g&#x2e;, a <a href="qtableview.html">QTableView</a>, the individual items are drawn by a delegate. Also, when an item is edited, it provides an editor widget, which is placed on top of the item view while editing takes place. QStyledItemDelegate is the default delegate for all Qt item views, and is installed upon them when they are created.</p>
<p>The QStyledItemDelegate 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>. The delegate allows the display and editing of items to be developed independently from the model and view.</p>
<p>The data of items in models are assigned an <a href="qt.html#ItemDataRole-enum">ItemDataRole</a>; each item can store a <a href="qvariant.html">QVariant</a> for each role. QStyledItemDelegate implements display and editing for the most common datatypes expected by users, including booleans, integers, and strings.</p>
<p>The data will be drawn differently depending on which role they have in the model. The following table describes the roles and the data types the delegate can handle for each of them. It is often sufficient to ensure that the model returns appropriate data for each of the roles to determine the appearance of items in views.</p>
<table class="generic">
<thead><tr class="qt-style"><th >Role</th><th >Accepted Types</th></tr></thead>
<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>
<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>
<tr valign="top" class="odd"><td ><a href="qt.html#ItemDataRole-enum">Qt::CheckStateRole</a></td><td ><a href="qt.html#CheckState-enum">Qt::CheckState</a></td></tr>
<tr valign="top" class="even"><td ><a href="qt.html#ItemDataRole-enum">Qt::DecorationRole</a></td><td ><a href="qicon.html">QIcon</a>, <a href="qpixmap.html">QPixmap</a>, <a href="qimage.html">QImage</a> and <a href="qcolor.html">QColor</a></td></tr>
<tr valign="top" class="odd"><td ><a href="qt.html#ItemDataRole-enum">Qt::DisplayRole</a></td><td ><a href="qstring.html">QString</a> and types with a string representation</td></tr>
<tr valign="top" class="even"><td ><a href="qt.html#ItemDataRole-enum">Qt::EditRole</a></td><td >See <a href="qitemeditorfactory.html">QItemEditorFactory</a> for details</td></tr>
<tr valign="top" class="odd"><td ><a href="qt.html#ItemDataRole-enum">Qt::FontRole</a></td><td ><a href="qfont.html">QFont</a></td></tr>
<tr valign="top" class="even"><td ><a href="qt.html#ItemDataRole-enum">Qt::SizeHintRole</a></td><td ><a href="qsize.html">QSize</a></td></tr>
<tr valign="top" class="odd"><td ><a href="qt.html#ItemDataRole-enum">Qt::TextAlignmentRole</a></td><td ><a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a></td></tr>
<tr valign="top" class="even"><td ><a href="qt.html#ItemDataRole-enum">Qt::ForegroundRole</a></td><td ><a href="qbrush.html">QBrush</a></td></tr>
<tr valign="top" class="odd"><td ><a href="qt.html#ItemDataRole-enum">Qt::TextColorRole</a></td><td ><a href="qcolor.html">QColor</a> (obsolete; use <a href="qt.html#ItemDataRole-enum">Qt::ForegroundRole</a> instead)</td></tr>
</table>
<p>Editors are created with a <a href="qitemeditorfactory.html">QItemEditorFactory</a>; a default static instance provided by <a href="qitemeditorfactory.html">QItemEditorFactory</a> is installed on all item delegates. You can set a custom factory using <a href="qstyleditemdelegate.html#setItemEditorFactory">setItemEditorFactory</a>() or set a new default factory with <a href="qitemeditorfactory.html#setDefaultFactory">QItemEditorFactory::setDefaultFactory</a>(). It is the data stored in the item model with the <a href="qt.html#ItemDataRole-enum">EditRole</a> that is edited. See the <a href="qitemeditorfactory.html">QItemEditorFactory</a> class for a more high-level introduction to item editor factories. The <a href="itemviews-coloreditorfactory.html">Color Editor Factory</a> example shows how to create custom editors with a factory.</p>
<a name="subclassing-qstyleditemdelegate"></a>
<h3>Subclassing QStyledItemDelegate</h3>
<p>If the delegate does not support painting of the data types you need or you want to customize the drawing of items, you need to subclass QStyledItemDelegate, and reimplement <a href="qstyleditemdelegate.html#paint">paint</a>() and possibly <a href="qstyleditemdelegate.html#sizeHint">sizeHint</a>(). The <a href="qstyleditemdelegate.html#paint">paint</a>() function is called individually for each item, and with <a href="qstyleditemdelegate.html#sizeHint">sizeHint</a>(), you can specify the hint for each of them.</p>
<p>When reimplementing <a href="qstyleditemdelegate.html#paint">paint</a>(), one would typically handle the datatypes one would like to draw and use the superclass implementation for other types.</p>
<p>The painting of check box indicators are performed by the current style. The style also specifies the size and the bounding rectangles in which to draw the data for the different data roles. The bounding rectangle of the item itself is also calculated by the style. When drawing already supported datatypes, it is therefore a good idea to ask the style for these bounding rectangles. The <a href="qstyle.html">QStyle</a> class description describes this in more detail.</p>
<p>If you wish to change any of the bounding rectangles calculated by the style or the painting of check box indicators, you can subclass <a href="qstyle.html">QStyle</a>. Note, however, that the size of the items can also be affected by reimplementing <a href="qstyleditemdelegate.html#sizeHint">sizeHint</a>().</p>
<p>It is possible for a custom delegate to provide editors without the use of an editor item factory. In this case, the following virtual functions must be reimplemented:</p>
<ul>
<li><a href="qstyleditemdelegate.html#createEditor">createEditor</a>() returns the widget used to change data from the model and can be reimplemented to customize editing behavior.</li>
<li><a href="qstyleditemdelegate.html#setEditorData">setEditorData</a>() provides the widget with data to manipulate.</li>
<li><a href="qstyleditemdelegate.html#updateEditorGeometry">updateEditorGeometry</a>() ensures that the editor is displayed correctly with respect to the item view.</li>
<li><a href="qstyleditemdelegate.html#setModelData">setModelData</a>() returns updated data to the model.</li>
</ul>
<p>The <a href="itemviews-stardelegate.html">Star Delegate</a> example creates editors by reimplementing these methods.</p>
<a name="qstyleditemdelegate-vs-qitemdelegate"></a>
<h3>QStyledItemDelegate vs. QItemDelegate</h3>
<p>Since Qt 4.4, there are two delegate classes: <a href="qitemdelegate.html">QItemDelegate</a> and QStyledItemDelegate. However, the default delegate is QStyledItemDelegate. These two classes are independent alternatives to painting and providing editors for items in views. The difference between them is that QStyledItemDelegate uses the current style to paint its items. We therefore recommend using QStyledItemDelegate as the base class when implementing custom delegates or when working with Qt style sheets. The code required for either class should be equal unless the custom delegate needs to use the style for drawing.</p>
<p>If you wish to customize the painting of item views, you should implement a custom style. Please see the <a href="qstyle.html">QStyle</a> class documentation for details.</p>
</div>
<p><b>See also </b><a href="model-view-programming.html#delegate-classes">Delegate Classes</a>, <a href="qitemdelegate.html">QItemDelegate</a>, <a href="qabstractitemdelegate.html">QAbstractItemDelegate</a>, <a href="qstyle.html">QStyle</a>, <a href="itemviews-spinboxdelegate.html">Spin Box Delegate Example</a>, <a href="itemviews-stardelegate.html">Star Delegate Example</a>, and <a href="itemviews-coloreditorfactory.html">Color Editor Factory Example</a>.</p>
<!-- @@@QStyledItemDelegate -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QStyledItemDelegate[overload1]$$$QStyledItemDelegateQObject* -->
<h3 class="fn"><a name="QStyledItemDelegate"></a>QStyledItemDelegate::<span class="name">QStyledItemDelegate</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>parent</i> = 0 )</h3>
<p>Constructs an item delegate with the given <i>parent</i>.</p>
<!-- @@@QStyledItemDelegate -->
<!-- $$$~QStyledItemDelegate[overload1]$$$~QStyledItemDelegate -->
<h3 class="fn"><a name="dtor.QStyledItemDelegate"></a>QStyledItemDelegate::<span class="name">~QStyledItemDelegate</span> ()</h3>
<p>Destroys the item delegate.</p>
<!-- @@@~QStyledItemDelegate -->
<!-- $$$createEditor[overload1]$$$createEditorQWidget*constQStyleOptionViewItem&constQModelIndex& -->
<h3 class="fn"><a name="createEditor"></a><span class="type"><a href="qwidget.html">QWidget</a></span> * QStyledItemDelegate::<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>Reimplemented from <a href="qabstractitemdelegate.html#createEditor">QAbstractItemDelegate::createEditor</a>().</p>
<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>
<p><b>See also </b><a href="qabstractitemdelegate.html#createEditor">QAbstractItemDelegate::createEditor</a>().</p>
<!-- @@@createEditor -->
<!-- $$$displayText[overload1]$$$displayTextconstQVariant&constQLocale& -->
<h3 class="fn"><a name="displayText"></a><span class="type"><a href="qstring.html">QString</a></span> QStyledItemDelegate::<span class="name">displayText</span> ( const <span class="type"><a href="qvariant.html">QVariant</a></span> &amp; <i>value</i>, const <span class="type"><a href="qlocale.html">QLocale</a></span> &amp; <i>locale</i> ) const<tt> [virtual]</tt></h3>
<p>This function returns the string that the delegate will use to display the <a href="qt.html#ItemDataRole-enum">Qt::DisplayRole</a> of the model in <i>locale</i>. <i>value</i> is the value of the <a href="qt.html#ItemDataRole-enum">Qt::DisplayRole</a> provided by the model.</p>
<p>The default implementation uses the QLocale::toString to convert <i>value</i> into a <a href="qstring.html">QString</a>.</p>
<p>This function is not called for empty model indices, i.e&#x2e;, indices for which the model returns an invalid <a href="qvariant.html">QVariant</a>.</p>
<p><b>See also </b><a href="qabstractitemmodel.html#data">QAbstractItemModel::data</a>().</p>
<!-- @@@displayText -->
<!-- $$$editorEvent[overload1]$$$editorEventQEvent*QAbstractItemModel*constQStyleOptionViewItem&constQModelIndex& -->
<h3 class="fn"><a name="editorEvent"></a><span class="type">bool</span> QStyledItemDelegate::<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 protected]</tt></h3>
<p>Reimplemented from <a href="qabstractitemdelegate.html#editorEvent">QAbstractItemDelegate::editorEvent</a>().</p>
<!-- @@@editorEvent -->
<!-- $$$eventFilter[overload1]$$$eventFilterQObject*QEvent* -->
<h3 class="fn"><a name="eventFilter"></a><span class="type">bool</span> QStyledItemDelegate::<span class="name">eventFilter</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>editor</i>, <span class="type"><a href="qevent.html">QEvent</a></span> * <i>event</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qobject.html#eventFilter">QObject::eventFilter</a>().</p>
<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>
<ul>
<li><b>Tab</b></li>
<li><b>Backtab</b></li>
<li><b>Enter</b></li>
<li><b>Return</b></li>
<li><b>Esc</b></li>
</ul>
<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>
<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>
<p><b>See also </b><a href="qabstractitemdelegate.html#commitData">commitData</a>() and <a href="qabstractitemdelegate.html#closeEditor">closeEditor</a>().</p>
<!-- @@@eventFilter -->
<!-- $$$initStyleOption[overload1]$$$initStyleOptionQStyleOptionViewItem*constQModelIndex& -->
<h3 class="fn"><a name="initStyleOption"></a><span class="type">void</span> QStyledItemDelegate::<span class="name">initStyleOption</span> ( <span class="type"><a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a></span> * <i>option</i>, const <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> &amp; <i>index</i> ) const<tt> [virtual protected]</tt></h3>
<p>Initialize <i>option</i> with the values using the index <i>index</i>. This method is useful for subclasses when they need a <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a>, but don't want to fill in all the information themselves. This function will check the version of the <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a> and fill in the additional values for a <a href="qstyleoptionviewitemv2.html">QStyleOptionViewItemV2</a>, <a href="qstyleoptionviewitemv3.html">QStyleOptionViewItemV3</a> and <a href="qstyleoptionviewitemv4.html">QStyleOptionViewItemV4</a>.</p>
<p><b>See also </b><a href="qstyleoption.html#initFrom">QStyleOption::initFrom</a>().</p>
<!-- @@@initStyleOption -->
<!-- $$$itemEditorFactory[overload1]$$$itemEditorFactory -->
<h3 class="fn"><a name="itemEditorFactory"></a><span class="type"><a href="qitemeditorfactory.html">QItemEditorFactory</a></span> * QStyledItemDelegate::<span class="name">itemEditorFactory</span> () const</h3>
<p>Returns the editor factory used by the item delegate. If no editor factory is set, the function will return null.</p>
<p><b>See also </b><a href="qstyleditemdelegate.html#setItemEditorFactory">setItemEditorFactory</a>().</p>
<!-- @@@itemEditorFactory -->
<!-- $$$paint[overload1]$$$paintQPainter*constQStyleOptionViewItem&constQModelIndex& -->
<h3 class="fn"><a name="paint"></a><span class="type">void</span> QStyledItemDelegate::<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> [virtual]</tt></h3>
<p>Reimplemented from <a href="qabstractitemdelegate.html#paint">QAbstractItemDelegate::paint</a>().</p>
<p>Renders the delegate using the given <i>painter</i> and style <i>option</i> for the item specified by <i>index</i>.</p>
<p>This function paints the item using the view's <a href="qstyle.html">QStyle</a>.</p>
<p>When reimplementing paint in a subclass. Use the <a href="qstyleditemdelegate.html#initStyleOption">initStyleOption</a>() to set up the <i>option</i> in the same way as the <a href="qstyleditemdelegate.html">QStyledItemDelegate</a>; the option will always be an instance of <a href="qstyleoptionviewitemv4.html">QStyleOptionViewItemV4</a>. Please see its class description for information on its contents.</p>
<p>Whenever possible, use the <i>option</i> while painting. Especially its <a href="qstyleoption.html#rect-var">rect</a> variable to decide where to draw and its <a href="qstyleoption.html#state-var">state</a> to determine if it is enabled or selected.</p>
<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>
<p><b>See also </b><a href="qitemdelegate.html#paint">QItemDelegate::paint</a>(), <a href="qstyle.html#drawControl">QStyle::drawControl</a>(), and <a href="qstyle.html#ControlElement-enum">QStyle::CE_ItemViewItem</a>.</p>
<!-- @@@paint -->
<!-- $$$setEditorData[overload1]$$$setEditorDataQWidget*constQModelIndex& -->
<h3 class="fn"><a name="setEditorData"></a><span class="type">void</span> QStyledItemDelegate::<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>Reimplemented from <a href="qabstractitemdelegate.html#setEditorData">QAbstractItemDelegate::setEditorData</a>().</p>
<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>
<p>The default implementation stores the data in the <i>editor</i> widget's <a href="properties.html#qt-s-property-system">user property</a>.</p>
<p><b>See also </b><a href="qmetaproperty.html#isUser">QMetaProperty::isUser</a>().</p>
<!-- @@@setEditorData -->
<!-- $$$setItemEditorFactory[overload1]$$$setItemEditorFactoryQItemEditorFactory* -->
<h3 class="fn"><a name="setItemEditorFactory"></a><span class="type">void</span> QStyledItemDelegate::<span class="name">setItemEditorFactory</span> ( <span class="type"><a href="qitemeditorfactory.html">QItemEditorFactory</a></span> * <i>factory</i> )</h3>
<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>
<p><b>See also </b><a href="qstyleditemdelegate.html#itemEditorFactory">itemEditorFactory</a>().</p>
<!-- @@@setItemEditorFactory -->
<!-- $$$setModelData[overload1]$$$setModelDataQWidget*QAbstractItemModel*constQModelIndex& -->
<h3 class="fn"><a name="setModelData"></a><span class="type">void</span> QStyledItemDelegate::<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>Reimplemented from <a href="qabstractitemdelegate.html#setModelData">QAbstractItemDelegate::setModelData</a>().</p>
<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>
<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#qt-s-property-system">user property</a>.</p>
<p><b>See also </b><a href="qmetaproperty.html#isUser">QMetaProperty::isUser</a>().</p>
<!-- @@@setModelData -->
<!-- $$$sizeHint[overload1]$$$sizeHintconstQStyleOptionViewItem&constQModelIndex& -->
<h3 class="fn"><a name="sizeHint"></a><span class="type"><a href="qsize.html">QSize</a></span> QStyledItemDelegate::<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> [virtual]</tt></h3>
<p>Reimplemented from <a href="qabstractitemdelegate.html#sizeHint">QAbstractItemDelegate::sizeHint</a>().</p>
<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>
<p>This function uses the view's <a href="qstyle.html">QStyle</a> to determine the size of the item.</p>
<p><b>See also </b><a href="qstyle.html#sizeFromContents">QStyle::sizeFromContents</a>() and <a href="qstyle.html#ContentsType-enum">QStyle::CT_ItemViewItem</a>.</p>
<!-- @@@sizeHint -->
<!-- $$$updateEditorGeometry[overload1]$$$updateEditorGeometryQWidget*constQStyleOptionViewItem&constQModelIndex& -->
<h3 class="fn"><a name="updateEditorGeometry"></a><span class="type">void</span> QStyledItemDelegate::<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>Reimplemented from <a href="qabstractitemdelegate.html#updateEditorGeometry">QAbstractItemDelegate::updateEditorGeometry</a>().</p>
<p>Updates the <i>editor</i> for the item specified by <i>index</i> according to the style <i>option</i> given.</p>
<!-- @@@updateEditorGeometry -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2013 Digia Plc and/or its
      subsidiaries. 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>
      Digia, Qt and their respective logos are trademarks of Digia Plc 
      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>