The 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 |
The 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 ,和 色彩编辑器工厂范例 .
构造编辑器创建者对象使用 valuePropertyName 作为要用于编辑的特性名。特性名用于 QItemDelegate 当设置和获取编辑器数据时。
注意, valuePropertyName is only used if the editor widget does not have a user property defined.
[虚拟]
QWidget
*QItemEditorCreator::
createWidget
(
QWidget
*
parent
) const
重实现自 QItemEditorCreatorBase::createWidget ().
[虚拟]
QByteArray
QItemEditorCreator::
valuePropertyName
() const