Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QStandardItemEditorCreator< T > Class Template Reference

The QStandardItemEditorCreator class provides the possibility to register widgets without having to subclass QItemEditorCreatorBase. More...

#include <qitemeditorfactory.h>

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

Public Member Functions

 QStandardItemEditorCreator ()
 Constructs an editor creator object.
 
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 QStandardItemEditorCreator< T >

The QStandardItemEditorCreator class provides the possibility to register widgets without having to subclass QItemEditorCreatorBase.

Since
4.2

\inmodule QtWidgets

This convenience template class makes it possible to register widgets without having to subclass QItemEditorCreatorBase.

Example:

editorFactory->registerEditor(QMetaType::QDateTime, creator);
The QItemEditorCreatorBase class provides an abstract base class that must be subclassed when impleme...
The QItemEditorFactory class provides widgets for editing item data in views and delegates.
void registerEditor(int userType, QItemEditorCreatorBase *creator)
Registers an item editor creator specified by creator for the given userType of data.
The QStandardItemEditorCreator class provides the possibility to register widgets without having to s...
QItemEditorFactory * editorFactory
[1]
QItemEditorCreatorBase * creator

Setting the editorFactory created above in an item delegate via QStyledItemDelegate::setItemEditorFactory() makes sure that all values of type QMetaType::QDateTime will be edited in {MyFancyDateTimeEdit}.

The editor must provide a user property that will contain the editing data. The property is used by \l{QStyledItemDelegate}s to set and retrieve the data (using Qt's \l{Meta-Object System}{meta-object system}). You set the user property with the USER keyword:

Q_PROPERTY(QColor color READ color WRITE setColor USER true)
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
#define Q_PROPERTY(...)
myFilter setColor(QColor(128, 0, 0))
See also
QItemEditorCreatorBase, QItemEditorCreator, QItemEditorFactory, QStyledItemDelegate, {Color Editor Factory Example}

Definition at line 41 of file qitemeditorfactory.h.

Constructor & Destructor Documentation

◆ QStandardItemEditorCreator()

template<class T >
template< class T > QStandardItemEditorCreator< T >::QStandardItemEditorCreator ( )
inline

Constructs an editor creator object.

Definition at line 44 of file qitemeditorfactory.h.

Member Function Documentation

◆ createWidget()

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

\reimp

Implements QItemEditorCreatorBase.

Definition at line 47 of file qitemeditorfactory.h.

References parent.

◆ valuePropertyName()

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

\reimp

Implements QItemEditorCreatorBase.

Definition at line 48 of file qitemeditorfactory.h.


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