QItemEditorCreator 類使之可能創建項編輯器創建者庫,無需子類化 QItemEditorCreatorBase . 更多...
| 頭: | #include <QItemEditorCreator> |
| qmake: | QT += widgets |
| Since: | Qt 4.2 |
| 繼承: | QItemEditorCreatorBase |
該類在 Qt 4.2 引入。
| QItemEditorCreator (const QByteArray & valuePropertyName ) |
| virtual QWidget * | createWidget (QWidget * parent ) const override |
| virtual QByteArray | valuePropertyName () const override |
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. QStyledItemDelegate 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 作為要用於編輯的特性名。特性名用於 QStyledItemDelegate 當設置和獲取編輯器數據時。
注意, valuePropertyName is only used if the editor widget does not have a user property defined.
[override virtual]
QWidget
*QItemEditorCreator::
createWidget
(
QWidget
*
parent
) const
重實現: QItemEditorCreatorBase::createWidget (QWidget *parent) const.
[override virtual]
QByteArray
QItemEditorCreator::
valuePropertyName
() const
重實現: QItemEditorCreatorBase::valuePropertyName () const.