QItemEditorCreator 類

template <typename T> class QItemEditorCreator

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 ,和 色彩編輯器工廠範例 .

成員函數文檔編製

QItemEditorCreator:: QItemEditorCreator (const QByteArray & valuePropertyName )

構造編輯器創建者對象使用 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.