QtBase
v6.3.1
|
The QItemEditorFactory class provides widgets for editing item data in views and delegates. More...
#include <qitemeditorfactory.h>
Public Member Functions | |
QItemEditorFactory () | |
virtual | ~QItemEditorFactory () |
virtual QWidget * | createEditor (int userType, QWidget *parent) const |
virtual QByteArray | valuePropertyName (int userType) const |
void | registerEditor (int userType, QItemEditorCreatorBase *creator) |
Static Public Member Functions | |
static const QItemEditorFactory * | defaultFactory () |
static void | setDefaultFactory (QItemEditorFactory *factory) |
The QItemEditorFactory class provides widgets for editing item data in views and delegates.
\inmodule QtWidgets
When editing data in an item view, editors are created and displayed by a delegate. QStyledItemDelegate, which is the delegate by default installed on Qt's item views, uses a QItemEditorFactory to create editors for it. A default unique instance provided by QItemEditorFactory is used by all item delegates. If you set a new default factory with setDefaultFactory(), the new factory will be used by existing and new delegates.
A factory keeps a collection of QItemEditorCreatorBase instances, which are specialized editors that produce editors for one particular QVariant data type (All Qt models store their data in \l{QVariant}s).
Definition at line 95 of file qitemeditorfactory.h.
|
inline |
Constructs a new item editor factory.
Definition at line 98 of file qitemeditorfactory.h.
|
virtual |
Destroys the item editor factory.
Definition at line 200 of file qitemeditorfactory.cpp.
Creates an editor widget with the given parent for the specified userType of data, and returns it as a QWidget.
Reimplemented in QDefaultItemEditorFactory.
Definition at line 174 of file qitemeditorfactory.cpp.
|
static |
Returns the default item editor factory.
Definition at line 350 of file qitemeditorfactory.cpp.
void QItemEditorFactory::registerEditor | ( | int | userType, |
QItemEditorCreatorBase * | creator | ||
) |
Registers an item editor creator specified by creator for the given userType of data.
{Note:} The factory takes ownership of the item editor creator and will destroy it if a new creator for the same type is registered later.
Definition at line 218 of file qitemeditorfactory.cpp.
|
static |
Sets the default item editor factory to the given factory. Both new and existing delegates will use the new factory.
Definition at line 364 of file qitemeditorfactory.cpp.
|
virtual |
Returns the property name used to access data for the given userType of data.
Reimplemented in QDefaultItemEditorFactory.
Definition at line 187 of file qitemeditorfactory.cpp.