The QStandardItemEditorCreator class provides the possibility to register widgets without having to subclass QItemEditorCreatorBase. More...
Header: | #include <QStandardItemEditorCreator> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
qmake: | QT += widgets |
Inherits: | QItemEditorCreatorBase |
virtual QWidget * | createWidget(QWidget *parent) const override |
virtual QByteArray | valuePropertyName() const override |
This convenience template class makes it possible to register widgets without having to subclass QItemEditorCreatorBase.
Example:
QItemEditorFactory *editorFactory = new QItemEditorFactory; QItemEditorCreatorBase *creator = new QStandardItemEditorCreator<MyFancyDateTimeEdit>(); editorFactory->registerEditor(QMetaType::QDateTime, 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 QStyledItemDelegates to set and retrieve the data (using Qt's meta-object system). You set the user property with the USER keyword:
Q_PROPERTY(QColor color READ color WRITE setColor USER true)
See also QItemEditorCreatorBase, QItemEditorCreator, QItemEditorFactory, QStyledItemDelegate, and Color Editor Factory Example.
Constructs an editor creator object.
[override virtual]
QWidget *QStandardItemEditorCreator::createWidget(QWidget *parent) constReimplements: QItemEditorCreatorBase::createWidget(QWidget *parent) const.
[override virtual]
QByteArray QStandardItemEditorCreator::valuePropertyName() constReimplements: QItemEditorCreatorBase::valuePropertyName() const.
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: