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