<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qitemeditorfactory.cpp --> <title>QItemEditorFactory 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 >QItemEditorFactory</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-functions">Public Functions</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> <li class="level2"><a href="#standard-editing-widgets">Standard Editing Widgets</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QItemEditorFactory Class</h1> <!-- $$$QItemEditorFactory-brief --> <p>The <a href="qitemeditorfactory.html">QItemEditorFactory</a> class provides widgets for editing item data in views and delegates. <a href="#details">More...</a></p> <!-- @@@QItemEditorFactory --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QItemEditorFactory></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"> Since:</td><td class="memItemRight bottomAlign"> Qt 4.2</td></tr></table></div><ul> <li><a href="qitemeditorfactory-members.html">List of all members, including inherited members</a></li> </ul> <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="qitemeditorfactory.html#QItemEditorFactory">QItemEditorFactory</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qitemeditorfactory.html#dtor.QItemEditorFactory">~QItemEditorFactory</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QWidget *</td><td class="memItemRight bottomAlign"><b><a href="qitemeditorfactory.html#createEditor">createEditor</a></b>(int <i>userType</i>, QWidget *<i>parent</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qitemeditorfactory.html#registerEditor">registerEditor</a></b>(int <i>userType</i>, QItemEditorCreatorBase *<i>creator</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qitemeditorfactory.html#valuePropertyName">valuePropertyName</a></b>(int <i>userType</i>) const</td></tr> </table></div> <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 QItemEditorFactory *</td><td class="memItemRight bottomAlign"><b><a href="qitemeditorfactory.html#defaultFactory">defaultFactory</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qitemeditorfactory.html#setDefaultFactory">setDefaultFactory</a></b>(QItemEditorFactory *<i>factory</i>)</td></tr> </table></div> <a name="details"></a> <!-- $$$QItemEditorFactory-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qitemeditorfactory.html">QItemEditorFactory</a> class provides widgets for editing item data in views and delegates.</p> <p>When editing data in an item view, editors are created and displayed by a delegate. <a href="qitemdelegate.html">QItemDelegate</a>, which is the delegate by default installed on Qt's item views, uses a <a href="qitemeditorfactory.html">QItemEditorFactory</a> to create editors for it. A default unique instance provided by <a href="qitemeditorfactory.html">QItemEditorFactory</a> is used by all item delegates. If you set a new default factory with <a href="qitemeditorfactory.html#setDefaultFactory">setDefaultFactory</a>(), the new factory will be used by existing and new delegates.</p> <p>A factory keeps a collection of <a href="qitemeditorcreatorbase.html">QItemEditorCreatorBase</a> instances, which are specialized editors that produce editors for one particular <a href="../qtcore/qvariant.html">QVariant</a> data type (All Qt models store their data in <a href="../qtcore/qvariant.html">QVariant</a>s).</p> <a name="standard-editing-widgets"></a> <h3 >Standard Editing Widgets</h3> <p>The standard factory implementation provides editors for a variety of data types. These are created whenever a delegate needs to provide an editor for data supplied by a model. The following table shows the relationship between types and the standard editors provided.</p> <div class="table"><table class="generic"> <thead><tr class="qt-style"><th >Type</th><th >Editor Widget</th></tr></thead> <tr valign="top" class="odd"><td >bool</td><td ><a href="qcombobox.html">QComboBox</a></td></tr> <tr valign="top" class="even"><td >double</td><td ><a href="qdoublespinbox.html">QDoubleSpinBox</a></td></tr> <tr valign="top" class="odd"><td >int</td><td rowspan="2"><a href="qspinbox.html">QSpinBox</a></td></tr> <tr valign="top" class="even"><td >unsigned int</td></tr> <tr valign="top" class="odd"><td ><a href="../qtcore/qdate.html">QDate</a></td><td ><a href="qdateedit.html">QDateEdit</a></td></tr> <tr valign="top" class="even"><td ><a href="../qtcore/qdatetime.html">QDateTime</a></td><td ><a href="qdatetimeedit.html">QDateTimeEdit</a></td></tr> <tr valign="top" class="odd"><td ><a href="../qtgui/qpixmap.html">QPixmap</a></td><td ><a href="qlabel.html">QLabel</a></td></tr> <tr valign="top" class="even"><td ><a href="../qtcore/qstring.html">QString</a></td><td ><a href="qlineedit.html">QLineEdit</a></td></tr> <tr valign="top" class="odd"><td ><a href="../qtcore/qtime.html">QTime</a></td><td ><a href="qtimeedit.html">QTimeEdit</a></td></tr> </table></div> <p>Additional editors can be registered with the <a href="qitemeditorfactory.html#registerEditor">registerEditor</a>() function.</p> </div> <p><b>See also </b><a href="qitemdelegate.html">QItemDelegate</a>, <a href="model-view-programming.html">Model/View Programming</a>, and <a href="qtwidgets-itemviews-coloreditorfactory-example.html">Color Editor Factory Example</a>.</p> <!-- @@@QItemEditorFactory --> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QItemEditorFactory[overload1]$$$QItemEditorFactory --> <h3 class="fn" id="QItemEditorFactory"><a name="QItemEditorFactory"></a>QItemEditorFactory::<span class="name">QItemEditorFactory</span>()</h3> <p>Constructs a new item editor factory.</p> <!-- @@@QItemEditorFactory --> <!-- $$$~QItemEditorFactory[overload1]$$$~QItemEditorFactory --> <h3 class="fn" id="dtor.QItemEditorFactory"><a name="dtor.QItemEditorFactory"></a><code>[virtual] </code>QItemEditorFactory::<span class="name">~QItemEditorFactory</span>()</h3> <p>Destroys the item editor factory.</p> <!-- @@@~QItemEditorFactory --> <!-- $$$createEditor[overload1]$$$createEditorintQWidget* --> <h3 class="fn" id="createEditor"><a name="createEditor"></a><code>[virtual] </code><span class="type"><a href="qwidget.html">QWidget</a></span> *QItemEditorFactory::<span class="name">createEditor</span>(<span class="type">int</span> <i>userType</i>, <span class="type"><a href="qwidget.html">QWidget</a></span> *<i>parent</i>) const</h3> <p>Creates an editor widget with the given <i>parent</i> for the specified <i>userType</i> of data, and returns it as a <a href="qwidget.html">QWidget</a>.</p> <p><b>See also </b><a href="qitemeditorfactory.html#registerEditor">registerEditor</a>().</p> <!-- @@@createEditor --> <!-- $$$defaultFactory[overload1]$$$defaultFactory --> <h3 class="fn" id="defaultFactory"><a name="defaultFactory"></a><code>[static] </code>const <span class="type"><a href="qitemeditorfactory.html#QItemEditorFactory">QItemEditorFactory</a></span> *QItemEditorFactory::<span class="name">defaultFactory</span>()</h3> <p>Returns the default item editor factory.</p> <p><b>See also </b><a href="qitemeditorfactory.html#setDefaultFactory">setDefaultFactory</a>().</p> <!-- @@@defaultFactory --> <!-- $$$registerEditor[overload1]$$$registerEditorintQItemEditorCreatorBase* --> <h3 class="fn" id="registerEditor"><a name="registerEditor"></a><span class="type">void</span> QItemEditorFactory::<span class="name">registerEditor</span>(<span class="type">int</span> <i>userType</i>, <span class="type"><a href="qitemeditorcreatorbase.html">QItemEditorCreatorBase</a></span> *<i>creator</i>)</h3> <p>Registers an item editor creator specified by <i>creator</i> for the given <i>userType</i> of data.</p> <p><b>Note:</b> The factory takes ownership of the item editor creator and will destroy it if a new creator for the same type is registered later.</p> <p><b>See also </b><a href="qitemeditorfactory.html#createEditor">createEditor</a>().</p> <!-- @@@registerEditor --> <!-- $$$setDefaultFactory[overload1]$$$setDefaultFactoryQItemEditorFactory* --> <h3 class="fn" id="setDefaultFactory"><a name="setDefaultFactory"></a><code>[static] </code><span class="type">void</span> QItemEditorFactory::<span class="name">setDefaultFactory</span>(<span class="type"><a href="qitemeditorfactory.html#QItemEditorFactory">QItemEditorFactory</a></span> *<i>factory</i>)</h3> <p>Sets the default item editor factory to the given <i>factory</i>. Both new and existing delegates will use the new factory.</p> <p><b>See also </b><a href="qitemeditorfactory.html#defaultFactory">defaultFactory</a>().</p> <!-- @@@setDefaultFactory --> <!-- $$$valuePropertyName[overload1]$$$valuePropertyNameint --> <h3 class="fn" id="valuePropertyName"><a name="valuePropertyName"></a><code>[virtual] </code><span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> QItemEditorFactory::<span class="name">valuePropertyName</span>(<span class="type">int</span> <i>userType</i>) const</h3> <p>Returns the property name used to access data for the given <i>userType</i> of data.</p> <!-- @@@valuePropertyName --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</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>