QtBase  v6.3.1
Public Member Functions | Static Public Member Functions | List of all members
QItemEditorFactory Class Reference

The QItemEditorFactory class provides widgets for editing item data in views and delegates. More...

#include <qitemeditorfactory.h>

Inheritance diagram for QItemEditorFactory:
Inheritance graph
[legend]

Public Member Functions

 QItemEditorFactory ()
 
virtual ~QItemEditorFactory ()
 
virtual QWidgetcreateEditor (int userType, QWidget *parent) const
 
virtual QByteArray valuePropertyName (int userType) const
 
void registerEditor (int userType, QItemEditorCreatorBase *creator)
 

Static Public Member Functions

static const QItemEditorFactorydefaultFactory ()
 
static void setDefaultFactory (QItemEditorFactory *factory)
 

Detailed Description

The QItemEditorFactory class provides widgets for editing item data in views and delegates.

Since
4.2

\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.

Constructor & Destructor Documentation

◆ QItemEditorFactory()

QItemEditorFactory::QItemEditorFactory ( )
inline

Constructs a new item editor factory.

Definition at line 98 of file qitemeditorfactory.h.

◆ ~QItemEditorFactory()

QItemEditorFactory::~QItemEditorFactory ( )
virtual

Destroys the item editor factory.

Definition at line 200 of file qitemeditorfactory.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ createEditor()

QWidget * QItemEditorFactory::createEditor ( int  userType,
QWidget parent 
) const
virtual

Creates an editor widget with the given parent for the specified userType of data, and returns it as a QWidget.

See also
registerEditor()

Reimplemented in QDefaultItemEditorFactory.

Definition at line 174 of file qitemeditorfactory.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ defaultFactory()

const QItemEditorFactory * QItemEditorFactory::defaultFactory ( )
static

Returns the default item editor factory.

See also
setDefaultFactory()

Definition at line 350 of file qitemeditorfactory.cpp.

Here is the caller graph for this function:

◆ registerEditor()

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.

See also
createEditor()

Definition at line 218 of file qitemeditorfactory.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDefaultFactory()

void QItemEditorFactory::setDefaultFactory ( QItemEditorFactory factory)
static

Sets the default item editor factory to the given factory. Both new and existing delegates will use the new factory.

See also
defaultFactory()

Definition at line 364 of file qitemeditorfactory.cpp.

◆ valuePropertyName()

QByteArray QItemEditorFactory::valuePropertyName ( int  userType) const
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.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: