<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html><head><title>QItemEditorCreatorBase Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } td.postheader { font-family: sans-serif } tr.address { font-family: sans-serif } body { background: #ffffff; color: black; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QItemEditorCreatorBase Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QItemEditorCreatorBase class provides an abstract base class that must be subclassed when implementing new item editor creators. <a href="#details">More...</a></p> <h3>Methods</h3><ul><li><div class="fn" /><b><a href="qitemeditorcreatorbase.html#QItemEditorCreatorBase">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qitemeditorcreatorbase.html#QItemEditorCreatorBase-2">__init__</a></b> (<i>self</i>, QItemEditorCreatorBase)</li><li><div class="fn" />QWidget <b><a href="qitemeditorcreatorbase.html#createWidget">createWidget</a></b> (<i>self</i>, QWidget <i>parent</i>)</li><li><div class="fn" />QByteArray <b><a href="qitemeditorcreatorbase.html#valuePropertyName">valuePropertyName</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QItemEditorCreatorBase class provides an abstract base class that must be subclassed when implementing new item editor creators.</p> <p>QItemEditorCreatorBase objects are specialized widget factories that provide editor widgets for one particular <a href="qvariant.html">QVariant</a> data type. They are used by <a href="qitemeditorfactory.html">QItemEditorFactory</a> to create editors for <a href="qitemdelegate.html">QItemDelegate</a>s. Creator bases must be registered with <a href="qitemeditorfactory.html#registerEditor">QItemEditorFactory.registerEditor</a>().</p> <p>An editor should provide a user property for the data it edits. QItemDelagates can then access the property using Qt's <a href="metaobjects.html#meta-object-system">meta-object system</a> to set and retrieve the editing data. A property is set as the user property with the USER keyword:</p> <pre class="cpp"> <a href="qobject.html#Q_PROPERTY">Q_PROPERTY</a>(<span class="type"><a href="qcolor.html">QColor</a></span> color READ color WRITE setColor USER <span class="keyword">true</span>) </pre> <p>If the editor does not provide a user property, it must return the name of the property from <a href="qitemeditorcreatorbase.html#valuePropertyName">valuePropertyName</a>(); delegates will then use the name to access the property. If a user property exists, item delegates will not call <a href="qitemeditorcreatorbase.html#valuePropertyName">valuePropertyName</a>().</p> <p><a href="qstandarditemeditorcreator.html">QStandardItemEditorCreator</a> is a convenience template class that can be used to register widgets without the need to subclass QItemEditorCreatorBase.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QItemEditorCreatorBase" />QItemEditorCreatorBase.__init__ (<i>self</i>)</h3><h3 class="fn"><a name="QItemEditorCreatorBase-2" />QItemEditorCreatorBase.__init__ (<i>self</i>, <a href="qitemeditorcreatorbase.html">QItemEditorCreatorBase</a>)</h3><h3 class="fn"><a name="createWidget" /><a href="qwidget.html">QWidget</a> QItemEditorCreatorBase.createWidget (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>parent</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Returns an editor widget with the given <i>parent</i>.</p> <p>When implementing this function in subclasses of this class, you must construct and return new editor widgets with the parent widget specified.</p> <h3 class="fn"><a name="valuePropertyName" /><a href="qbytearray.html">QByteArray</a> QItemEditorCreatorBase.valuePropertyName (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the name of the property used to get and set values in the creator's editor widgets.</p> <p>When implementing this function in subclasses, you must ensure that the editor widget's property specified by this function can accept the type the creator is registered for. For example, a creator which constructs <a href="qcheckbox.html">QCheckBox</a> widgets to edit boolean values would return the <a href="qabstractbutton.html#checkable-prop">checkable</a> property name from this function, and must be registered in the item editor factory for the <a href="qvariant.html#Type-enum">QVariant.Bool</a> type.</p> <p>Note: Since Qt 4.2 the item delegates query the user property of widgets, and only call this function if the widget has no user property. You can override this behavior by reimplementing <a href="qabstractitemdelegate.html#setModelData">QAbstractItemDelegate.setModelData</a>() and <a href="qabstractitemdelegate.html#setEditorData">QAbstractItemDelegate.setEditorData</a>().</p> <p><b>See also</b> <a href="qmetaobject.html#userProperty">QMetaObject.userProperty</a>() and <a href="qitemeditorfactory.html#registerEditor">QItemEditorFactory.registerEditor</a>().</p> <address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>