Qt 6.x
The Qt SDK
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QItemEditorCreator< T > Class Template Reference

The QItemEditorCreator class makes it possible to create item editor creator bases without subclassing QItemEditorCreatorBase. More...

#include <qitemeditorfactory.h>

+ Inheritance diagram for QItemEditorCreator< T >:
+ Collaboration diagram for QItemEditorCreator< T >:

Public Member Functions

 QItemEditorCreator (const QByteArray &valuePropertyName)
 Constructs an editor creator object using valuePropertyName as the name of the property to be used for editing.
 
QWidgetcreateWidget (QWidget *parent) const override
 \reimp
 
QByteArray valuePropertyName () const override
 \reimp
 
- Public Member Functions inherited from QItemEditorCreatorBase
virtual ~QItemEditorCreatorBase ()
 Destroys the editor creator object.
 
virtual QWidgetcreateWidget (QWidget *parent) const =0
 Returns an editor widget with the given parent.
 
virtual QByteArray valuePropertyName () const =0
 Returns the name of the property used to get and set values in the creator's editor widgets.
 

Detailed Description

template<class T>
class QItemEditorCreator< T >

The QItemEditorCreator class makes it possible to create item editor creator bases without subclassing QItemEditorCreatorBase.

Since
4.2

\inmodule QtWidgets

QItemEditorCreator is a convenience template class. It uses the template class to create editors for QItemEditorFactory. This way, it is not necessary to subclass QItemEditorCreatorBase.

new QItemEditorCreator<MyEditor>("myProperty");
The QItemEditorCreator class makes it possible to create item editor creator bases without subclassin...
The QItemEditorFactory class provides widgets for editing item data in views and delegates.
QItemEditorFactory * factory
QItemEditorCreator< MyEditor > * itemCreator
[0]

The constructor takes the name of the property that contains the editing data. QStyledItemDelegate can then access the property by name when it sets and retrieves editing data. Only use this class if your editor does not define a user property (using the USER keyword in the Q_PROPERTY macro). If the widget has a user property, you should use QStandardItemEditorCreator instead.

See also
QItemEditorCreatorBase, QStandardItemEditorCreator, QItemEditorFactory, {Color Editor Factory Example}

Definition at line 29 of file qitemeditorfactory.h.

Constructor & Destructor Documentation

◆ QItemEditorCreator()

template<class T >
Q_INLINE_TEMPLATE QItemEditorCreator< T >::QItemEditorCreator ( const QByteArray valuePropertyName)
inlineexplicit

Constructs an editor creator object using valuePropertyName as the name of the property to be used for editing.

The property name is used by QStyledItemDelegate when setting and getting editor data.

Note that the valuePropertyName is only used if the editor widget does not have a user property defined.

Definition at line 56 of file qitemeditorfactory.h.

Member Function Documentation

◆ createWidget()

template<class T >
template< class T > QWidget * QItemEditorCreator< T >::createWidget ( QWidget parent) const
inlineoverridevirtual

\reimp

Implements QItemEditorCreatorBase.

Definition at line 33 of file qitemeditorfactory.h.

References parent.

◆ valuePropertyName()

template<class T >
template< class T > QByteArray QItemEditorCreator< T >::valuePropertyName ( ) const
inlineoverridevirtual

\reimp

Implements QItemEditorCreatorBase.

Definition at line 34 of file qitemeditorfactory.h.


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