diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2023-10-04 16:34:16 +0200 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2023-10-05 21:08:45 +0200 |
commit | 4e8b54eb811f8c6064fd2e937711efe68543087c (patch) | |
tree | 28aca92c964de790d7953b22590cd3870d3d67b5 /examples/widgets/doc | |
parent | 9ed25b413ff2e5055ec03fd6e1f8ba5dfcfc499a (diff) |
Preparations to deprecate QItemDelegate
QItemDelegate was superseded since Qt4 by QStyledItemDelegate but it
took until Qt6.7 to remove the last occurrences in qtbase.
- remove unused includes / replace with qabstractitemdelegate.h
- replace references in the documentation with QStyledItemDelegate
- adjust the examples and tests to use QStyledItemDelegate
Pick-to: 6.5 6.6
Change-Id: I246755004ce2d01192a726ca0972106c237df0cc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'examples/widgets/doc')
-rw-r--r-- | examples/widgets/doc/src/coloreditorfactory.qdoc | 12 | ||||
-rw-r--r-- | examples/widgets/doc/src/combowidgetmapper.qdoc | 8 |
2 files changed, 10 insertions, 10 deletions
diff --git a/examples/widgets/doc/src/coloreditorfactory.qdoc b/examples/widgets/doc/src/coloreditorfactory.qdoc index bf4a13c9e7..f43a7eb95c 100644 --- a/examples/widgets/doc/src/coloreditorfactory.qdoc +++ b/examples/widgets/doc/src/coloreditorfactory.qdoc @@ -7,13 +7,13 @@ \examplecategory {User Interface Components} \ingroup examples-itemviews \brief This example shows how to create an editor that can be used by - a QItemDelegate. + a QStyledItemDelegate. \image coloreditorfactoryimage.png When editing data in a QListView, QTableView, or QTreeView, editors are created and displayed by a \l{Delegate - Classes}{delegate}. QItemDelegate, which is the default delegate + Classes}{delegate}. QStyledItemDelegate, which is the default delegate used by Qt's \l{View Classes}{item views}, uses a QItemEditorFactory to create editors for it. A unique instance provided by QItemEditorFactory is by default installed on all @@ -27,7 +27,7 @@ In this example, we will create an editor (implemented in the \c ColorListEditor class) that can edit the QColor data type and be - used by \l{QItemDelegate}s. We do this by creating a new + used by \l{QStyledItemDelegate}s. We do this by creating a new QItemEditorCreatorBase that produces \c ColorListEditors and register it with a new factory, which we set as the default editor item factory (the unique factory instance). To test our editor, we @@ -67,7 +67,7 @@ \snippet itemviews/coloreditorfactory/colorlisteditor.h 0 - QItemDelegate manages the interaction between the editor and + QStyledItemDelegate manages the interaction between the editor and the model, i.e., it retrieves data to edit from the model and store data from the editor in the model. The data that is edited by an editor is stored in the editor's user data property, and the @@ -106,7 +106,7 @@ usually sufficient to provide custom editors. Further customization is achieved by subclassing QItemEditorFactory and QItemEditorCreatorBase. It is also possible to subclass - QItemDelegate if you don't wish to use a factory at all. + QStyledItemDelegate if you don't wish to use a factory at all. Possible suggestions are: @@ -128,5 +128,5 @@ In this example, we use a standard QVariant data type. You can also use custom types. In the \l{Star Delegate Example}, we show how to store a custom data type in a QVariant and paint - and edit it in a class that inherits QItemDelegate. + and edit it in a class that inherits QStyledItemDelegate. */ diff --git a/examples/widgets/doc/src/combowidgetmapper.qdoc b/examples/widgets/doc/src/combowidgetmapper.qdoc index 8a3e285dfe..aae546005c 100644 --- a/examples/widgets/doc/src/combowidgetmapper.qdoc +++ b/examples/widgets/doc/src/combowidgetmapper.qdoc @@ -88,7 +88,7 @@ \section1 Delegate Class Definition and Implementation The delegate we use to mediate interaction between the widget mapper and - the input widgets is a small QItemDelegate subclass: + the input widgets is a small QStyledItemDelegate subclass: \snippet itemviews/combowidgetmapper/delegate.h Delegate class definition @@ -99,7 +99,7 @@ Since we only provide an empty implementation of the constructor, we concentrate on the other two functions. - The \l{QItemDelegate::}{setEditorData()} implementation takes the data + The \l{QStyledItemDelegate::}{setEditorData()} implementation takes the data referred to by the model index supplied and processes it according to the presence of a \c currentIndex property in the editor widget: @@ -111,10 +111,10 @@ values needed for the \c currentIndex property. As a result, instead of showing "0", "1" or "2" in the combo box, one of - its predefined set of items is shown. We call QItemDelegate::setEditorData() + its predefined set of items is shown. We call QStyledItemDelegate::setEditorData() for widgets without the \c currentIndex property. - The \l{QItemDelegate::}{setModelData()} implementation performs the reverse + The \l{QStyledItemDelegate::}{setModelData()} implementation performs the reverse process, taking the value stored in the widget's \c currentIndex property and storing it back in the model: |