QStandardItemEditorCreator 類

The QStandardItemEditorCreator class provides the possibility to register widgets without having to subclass QItemEditorCreatorBase . 更多...

頭: #include <QStandardItemEditorCreator>
qmake: QT += widgets
Since: Qt 4.2
繼承: QItemEditorCreatorBase

公共函數

QStandardItemEditorCreator ()

重實現公共函數

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

詳細描述

The QStandardItemEditorCreator class provides the possibility to register widgets without having to subclass QItemEditorCreatorBase .

This convenience template class makes it possible to register widgets without having to subclass QItemEditorCreatorBase .

範例:

QItemEditorFactory *editorFactory = new QItemEditorFactory;
QItemEditorCreatorBase *creator = new QStandardItemEditorCreator<MyFancyDateTimeEdit>();
editorFactory->registerEditor(QVariant::DateType, creator);
					

設置 editorFactory created above in an item delegate via QItemDelegate::setItemEditorFactory () makes sure that all values of type QVariant::DateTime will be edited in MyFancyDateTimeEdit .

The editor must provide a user property that will contain the editing data. The property is used by QItemDelegate s to set and retrieve the data (using Qt's 元對象係統 ). You set the user property with the USER keyword:

Q_PROPERTY(QColor color READ color WRITE setColor USER true)
					

另請參閱 QItemEditorCreatorBase , QItemEditorCreator , QItemEditorFactory , QItemDelegate ,和 色彩編輯器工廠範例 .

成員函數文檔編製

QStandardItemEditorCreator:: QStandardItemEditorCreator ()

Constructs an editor creator object.

[override virtual] QWidget *QStandardItemEditorCreator:: createWidget ( QWidget * parent ) const

重實現自 QItemEditorCreatorBase::createWidget ().

[override virtual] QByteArray QStandardItemEditorCreator:: valuePropertyName () const

重實現自 QItemEditorCreatorBase::valuePropertyName ().