QItemEditorCreator 类

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

头: #include <QItemEditorCreator>
qmake: QT += widgets
Since: Qt 4.2
继承: QItemEditorCreatorBase

公共函数

QItemEditorCreator (const QByteArray & valuePropertyName )

重实现公共函数

virtual QWidget * createWidget (QWidget * parent ) const
virtual QByteArray valuePropertyName () const

详细描述

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

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 .

QItemEditorCreator<MyEditor> *itemCreator =
    new QItemEditorCreator<MyEditor>("myProperty");
QItemEditorFactory *factory = new QItemEditorFactory;
					

The constructor takes the name of the property that contains the editing data. QItemDelegate 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 代替。

另请参阅 QItemEditorCreatorBase , QStandardItemEditorCreator , QItemEditorFactory ,和 色彩编辑器工厂范例 .

成员函数文档编制

QItemEditorCreator:: QItemEditorCreator (const QByteArray & valuePropertyName )

构造编辑器创建者对象使用 valuePropertyName 作为要用于编辑的特性名。特性名用于 QItemDelegate 当设置和获取编辑器数据时。

注意, valuePropertyName is only used if the editor widget does not have a user property defined.

[virtual] QWidget *QItemEditorCreator:: createWidget ( QWidget * parent ) const

重实现自 QItemEditorCreatorBase::createWidget ().

[virtual] QByteArray QItemEditorCreator:: valuePropertyName () const

重实现自 QItemEditorCreatorBase::valuePropertyName ().