![]() |
Home · Overviews · Examples | ![]() |
The QAbstractItemDelegate class is used to display and edit data items from a model. More...
Inherits QObject.
Inherited by QItemDelegate.
The QAbstractItemDelegate class is used to display and edit data items from a model.
A QAbstractItemDelegate provides the interface and common functionality for delegates in the model/view architecture. Delegates display individual items in views, and handle the editing of model data.
The QAbstractItemDelegate class is one of the Model/View Classes and is part of Qt's model/view framework.
To render an item in a custom way, you must implement paint and sizeHint. The QItemDelegate class provides default implementations for these functions; if you do not need custom rendering, subclass that class instead.
To provide custom editing, there are two approaches that can be used. The first approach is to create an editor widget and display it directly on top of the item. To do this you must reimplement createEditor to provide an editor widget, setEditorData to populate the editor with the data from the model, and setModelData so that the delegate can update the model with data from the editor.
The second approach is to handle user events directly by reimplementing editorEvent.
See also Model/View Programming, QItemDelegate, and Pixelator Example.
Copyright © 2008 Trolltech | Trademarks | Qt Jambi 4.3.4_01 |