QtopiaItemDelegate Class Reference
|
Role | Accepted Types |
---|---|
Qt::BackgroundRole | QBrush |
Qt::BackgroundColorRole | QColor (obsolete; use Qt::BackgroundRole instead) |
Qt::CheckStateRole | Qt::CheckState |
Qt::DecorationRole | QIcon and QColor |
Qt::DisplayRole | QString and types with a string representation |
Qt::EditRole | See QItemEditorFactory for details |
Qt::FontRole | QFont |
Qt::SizeHintRole | QSize |
Qt::TextAlignmentRole | Qt::Alignment |
Qt::ForegroundRole | QBrush |
Qt::TextColorRole | QColor (obsolete; use Qt::ForegroundRole instead) |
If the default delegate does not allow the level of customization that you need, either for display purposes or for editing data, it is possible to subclass QtopiaItemDelegate to implement the desired behavior.
When subclassing QtopiaItemDelegate to create a delegate that displays items using a custom renderer, it is important to ensure that the delegate can render items suitably for all the required states; e.g. selected, disabled, checked. The documentation for the paint() function contains some hints to show how this can be achieved.
Custom editing features for can be added by subclassing QtopiaItemDelegate and reimplementing createEditor(), setEditorData(), setModelData(), and updateEditorGeometry(). This process is described in the Spin Box Delegate example.
See also Delegate Classes, QItemDelegate, QAbstractItemDelegate, Spin Box Delegate Example, Settings Editor Example, and Icons Example.
Constructs an item delegate with the given parent.
Destroys the item delegate.
Renders the additional decoration within the rectangle specified by rect using the given painter and style option.
Renders the item background for the given index, using the given painter and style option.
Renders a check indicator within the rectangle specified by rect, using the given painter and style option, using the given state.
Reimplemented from QItemDelegate.
Renders the pixmap within the rectangle specified by rect using the given painter and style option.
Reimplemented from QItemDelegate.
This is an overloaded member function, provided for convenience.
Renders the decoration within the rectangle specified by rect using the given painter and style option.
Renders the item view text within the rectangle specified by rect using the given painter and style option.
Reimplemented from QItemDelegate.
Renders the region within the rectangle specified by rect, indicating that it has the focus, using the given painter and style option.
Reimplemented from QItemDelegate.
Returns true if the given editor is a valid QWidget and the given event is handled; otherwise returns false. The following key press events are handled by default:
In the case of Tab, Backtab, Enter and Return key press events, the editor's data is comitted to the model and the editor is closed. If the event is a Tab key press the view will open an editor on the next item in the view. Likewise, if the event is a Backtab key press the view will open an editor on the previous item in the view.
If the event is a Esc key press event, the editor is closed without committing its data.
Reimplemented from QObject.
See also commitData() and closeEditor().
Renders the delegate using the given painter and style option for the item specified by index.
When reimplementing this function in a subclass, you should update the area held by the option's rect variable, using the option's state variable to determine the state of the item to be displayed, and adjust the way it is painted accordingly. For example, a selected item may need to be displayed differently to unselected items.
After painting, you should ensure that the painter is returned to its the state it was supplied in when this function was called. For example, it may be useful to call QPainter::save() before painting and QPainter::restore() afterwards.
Reimplemented from QAbstractItemDelegate.
See also QStyle::State.
Returns the size needed by the delegate to display the item specified by index, taking into account the style information provided by option.
When reimplementing this function, note that in case of text items, QtopiaItemDelegate adds a margin (i.e. 2 * QStyle::PM_FocusFrameHMargin) to the length of the text.
Reimplemented from QAbstractItemDelegate.
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 qtextended4.4 | |
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 ! |
Copyright © 2000-2012 - www.developpez.com