IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QStandardItemEditorCreator Class

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

This class was introduced in Qt 4.2.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QStandardItemEditorCreator Class

  • Header: QStandardItemEditorCreator

  • Since: Qt 4.2

  • qmake: QT += widgets

  • Group: QStandardItemEditorCreator is part of model-view

Detailed Description

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

Example:

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

Setting the editorFactory created above in an item delegate via QStyledItemDelegate::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 QStyledItemDelegates to set and retrieve the data (using Qt's meta-object system). You set the user property with the USER keyword:

 
Sélectionnez
Q_PROPERTY(QColor color READ color WRITE setColor USER true)

See Also

See also QItemEditorCreatorBase, QItemEditorCreator, QItemEditorFactory, QStyledItemDelegate, Color Editor Factory Example

Member Function Documentation

 

QStandardItemEditorCreator::QStandardItemEditorCreator()

Constructs an editor creator object.

QWidget *QStandardItemEditorCreator::createWidget(QWidget *parent) const

 

int QStandardItemEditorCreator::valuePropertyName() const

 

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+