このページでは

QStandardItemEditorCreator Class

template <typename T> class QStandardItemEditorCreator

QStandardItemEditorCreator クラスを使用すると、QItemEditorCreatorBase をサブクラス化することなくウィジェットを登録することができます。詳細...

ヘッダー: #include <QStandardItemEditorCreator>
CMake: find_package(Qt6 REQUIRED COMPONENTS Widgets)
target_link_libraries(mytarget PRIVATE Qt6::Widgets)
qmake: QT += widgets
継承元: QItemEditorCreatorBase

パブリック関数

再実装されたパブリック関数

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

詳細な説明

QStandardItemEditorCreator<T> は、T がウィジェットの型を指定する便利なテンプレートクラスです。これにより、QItemEditorCreatorBase をサブクラス化することなく、ウィジェットを登録することが可能になります。

例:

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

上記で作成したeditorFactory を、QStyledItemDelegate::setItemEditorFactory()を介してアイテムデリゲートに設定することで、QMetaType::QDateTime 型のすべての値がMyFancyDateTimeEdit で編集されるようになります。

エディタは、編集データを格納するユーザープロパティを提供する必要があります。このプロパティは、QStyledItemDelegateが(Qtのメタオブジェクトシステムを使用して)データを設定および取得するために使用されます。ユーザープロパティは、USERキーワードを使用して設定します:

Q_PROPERTY(QColor color READ color WRITE setColor USER true)

関連項目: QItemEditorCreatorBase 、QItemEditorCreator 、QItemEditorFactory 、およびQStyledItemDelegate 。

メンバ関数のドキュメント

QStandardItemEditorCreator::QStandardItemEditorCreator()

エディタ作成オブジェクトを生成します。

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

QItemEditorCreatorBase::createWidget(QWidget *parent) const を再実装します。

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

QItemEditorCreatorBase::valuePropertyName() const を再実装します。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.