QStandardItemEditorCreator Class
The QStandardItemEditorCreator class provides the possibility to register widgets without having to subclass QItemEditorCreatorBase. 更多...
头文件: | #include <QStandardItemEditorCreator> |
qmake: | QT += widgets |
开始支持版本: | Qt 4.2 |
基类: | QItemEditorCreatorBase |
公有函数
重新实现的公有函数
virtual QWidget * | createWidget(QWidget *parent) const override |
virtual QByteArray | valuePropertyName() const override |
- 2 个公有函数继承自 QItemEditorCreatorBase
详细描述
The QStandardItemEditorCreator class provides the possibility to register widgets without having to subclass QItemEditorCreatorBase.
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(QVariant::DateType, creator);
Setting the editorFactory
created above in an item delegate via QItemDelegate::setItemEditorFactory() makes sure that all values of type QVariant::DateTime will be edited in MyFancyDateTimeEdit
.
The editor must provide a user property that will contain the editing data. The property is used by QItemDelegates 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)
参见 QItemEditorCreatorBase, QItemEditorCreator, QItemEditorFactory, QItemDelegate, and Color Editor Factory Example.
成员函数
QStandardItemEditorCreator::QStandardItemEditorCreator()
Constructs an editor creator object.
[override virtual]
QWidget *QStandardItemEditorCreator::createWidget(QWidget *parent) const
重新实现 QItemEditorCreatorBase::createWidget().