Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QItemEditorCreatorBase Class

The QItemEditorCreatorBase class provides an abstract base class that must be subclassed when implementing new item editor creators. More...

 #include <QItemEditorCreatorBase>

Inherited by: QItemEditorCreator and QStandardItemEditorCreator.

This class was introduced in Qt 4.2.

Public Functions

virtual ~QItemEditorCreatorBase()
virtual QWidget * createWidget(QWidget * parent) const = 0
virtual QByteArray valuePropertyName() const = 0

Detailed Description

The QItemEditorCreatorBase class provides an abstract base class that must be subclassed when implementing new item editor creators.

QItemEditorCreatorBase objects are specialized widget factories that provide editor widgets for one particular QVariant data type. They are used by QItemEditorFactory to create editors for QItemDelegates. Creator bases must be registered with QItemEditorFactory::registerEditor().

An editor should provide a user property for the data it edits. QItemDelagates can then access the property using Qt's meta-object system to set and retrieve the editing data. A property is set as the user property with the USER keyword:

 Q_PROPERTY(QColor color READ color WRITE setColor USER true)

If the editor does not provide a user property, it must return the name of the property from valuePropertyName(); delegates will then use the name to access the property. If a user property exists, item delegates will not call valuePropertyName().

QStandardItemEditorCreator is a convenience template class that can be used to register widgets without the need to subclass QItemEditorCreatorBase.

See also QStandardItemEditorCreator, QItemEditorFactory, Model/View Programming, and Color Editor Factory Example.

Member Function Documentation

QItemEditorCreatorBase::~QItemEditorCreatorBase() [virtual]

Destroys the editor creator object.

QWidget * QItemEditorCreatorBase::createWidget(QWidget * parent) const [pure virtual]

Returns an editor widget with the given parent.

When implementing this function in subclasses of this class, you must construct and return new editor widgets with the parent widget specified.

QByteArray QItemEditorCreatorBase::valuePropertyName() const [pure virtual]

Returns the name of the property used to get and set values in the creator's editor widgets.

When implementing this function in subclasses, you must ensure that the editor widget's property specified by this function can accept the type the creator is registered for. For example, a creator which constructs QCheckBox widgets to edit boolean values would return the checkable property name from this function, and must be registered in the item editor factory for the QVariant::Bool(obsolete) type.

Note: Since Qt 4.2 the item delegates query the user property of widgets, and only call this function if the widget has no user property. You can override this behavior by reimplementing QAbstractItemDelegate::setModelData() and QAbstractItemDelegate::setEditorData().

See also QMetaObject::userProperty() and QItemEditorFactory::registerEditor().

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web