diff --git a/examples/network/torrent/mainwindow.cpp b/examples/network/torrent/mainwindow.cpp index 4c898743ba8..2b5d0a8757b 100644 --- a/examples/network/torrent/mainwindow.cpp +++ b/examples/network/torrent/mainwindow.cpp @@ -26,17 +26,17 @@ protected: }; // TorrentViewDelegate is used to draw the progress bars. -class TorrentViewDelegate : public QItemDelegate +class TorrentViewDelegate : public QStyledItemDelegate { Q_OBJECT public: - inline TorrentViewDelegate(MainWindow *mainWindow) : QItemDelegate(mainWindow) {} + inline TorrentViewDelegate(MainWindow *mainWindow) : QStyledItemDelegate(mainWindow) {} void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const override { if (index.column() != 2) { - QItemDelegate::paint(painter, option, index); + QStyledItemDelegate::paint(painter, option, index); return; } diff --git a/examples/sql/doc/src/sqlwidgetmapper.qdoc b/examples/sql/doc/src/sqlwidgetmapper.qdoc index 7740e50b2ee..0764e601c3a 100644 --- a/examples/sql/doc/src/sqlwidgetmapper.qdoc +++ b/examples/sql/doc/src/sqlwidgetmapper.qdoc @@ -115,7 +115,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 sqlwidgetmapper/delegate.h Delegate class definition @@ -126,7 +126,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: @@ -138,10 +138,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: diff --git a/examples/widgets/doc/src/coloreditorfactory.qdoc b/examples/widgets/doc/src/coloreditorfactory.qdoc index bf4a13c9e71..f43a7eb95ca 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 8a3e285dfe2..aae546005c1 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: diff --git a/src/sql/doc/src/sql-programming.qdoc b/src/sql/doc/src/sql-programming.qdoc index 3dfd005516f..a7f87fe73fa 100644 --- a/src/sql/doc/src/sql-programming.qdoc +++ b/src/sql/doc/src/sql-programming.qdoc @@ -496,11 +496,11 @@ submitted. The items in the view are rendered using a delegate. The default - delegate, QItemDelegate, handles the most common data types (\c + delegate, QStyledItemDelegate, handles the most common data types (\c int, QString, QImage, etc.). The delegate is also responsible for providing editor widgets (e.g., a combobox) when the user starts editing an item in the view. You can create your own delegates by - subclassing QAbstractItemDelegate or QItemDelegate. See + subclassing QAbstractItemDelegate or QStyledItemDelegate. See \l{Model/View Programming} for more information. QSqlTableModel is optimized to operate on a single table at a diff --git a/src/widgets/itemviews/qdatawidgetmapper.cpp b/src/widgets/itemviews/qdatawidgetmapper.cpp index 06d59b34a04..0b43707b02e 100644 --- a/src/widgets/itemviews/qdatawidgetmapper.cpp +++ b/src/widgets/itemviews/qdatawidgetmapper.cpp @@ -4,7 +4,6 @@ #include "qdatawidgetmapper.h" #include "qabstractitemmodel.h" -#include "qitemdelegate.h" #include "qmetaobject.h" #include "qwidget.h" #include "qstyleditemdelegate.h" @@ -234,7 +233,7 @@ void QDataWidgetMapperPrivate::modelDestroyed() instead of the default user property. It is possible to set an item delegate to support custom widgets. By default, - a QItemDelegate is used to synchronize the model with the widgets. + a QStyledItemDelegate is used to synchronize the model with the widgets. Let us assume that we have an item model named \c{model} with the following contents: diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp index 7b164da040a..a91902813a9 100644 --- a/src/widgets/itemviews/qlistwidget.cpp +++ b/src/widgets/itemviews/qlistwidget.cpp @@ -3,7 +3,6 @@ #include "qlistwidget.h" -#include #include #include #include diff --git a/src/widgets/itemviews/qlistwidget_p.h b/src/widgets/itemviews/qlistwidget_p.h index b0f315299e3..1007542ddcd 100644 --- a/src/widgets/itemviews/qlistwidget_p.h +++ b/src/widgets/itemviews/qlistwidget_p.h @@ -18,7 +18,6 @@ #include #include #include -#include #include #include diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index eeb0b5ac5ad..0c7750750c2 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -6,7 +6,7 @@ #include "qtableview.h" #include -#include +#include #include #include #include diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp index 91e89fe9d31..6dd812f6fbf 100644 --- a/src/widgets/itemviews/qtablewidget.cpp +++ b/src/widgets/itemviews/qtablewidget.cpp @@ -3,7 +3,6 @@ #include "qtablewidget.h" -#include #include #include diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 38159277d5c..c6ed979c132 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -3,7 +3,7 @@ #include "qtreeview.h" #include -#include +#include #include #include #include diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 611bd0c9ce9..51e31deffbe 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -5,7 +5,6 @@ #include #include -#include #include #include #include diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index e26564da08b..a9086ec4dc2 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -12,7 +12,7 @@ #if QT_CONFIG(tableview) #include #endif -#include +#include #include #if QT_CONFIG(menu) #include diff --git a/src/widgets/widgets/qfontcombobox.cpp b/src/widgets/widgets/qfontcombobox.cpp index 118e7945df7..0083a5eceac 100644 --- a/src/widgets/widgets/qfontcombobox.cpp +++ b/src/widgets/widgets/qfontcombobox.cpp @@ -3,9 +3,9 @@ #include "qfontcombobox.h" +#include #include #include -#include #include #include #include diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index 23390dc04cb..945cf334343 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include @@ -806,7 +806,7 @@ void tst_QFiledialog::itemDelegate() { QFileDialog fd; QVERIFY(fd.itemDelegate() != 0); - QItemDelegate *id = new QItemDelegate(&fd); + QStyledItemDelegate *id = new QStyledItemDelegate(&fd); fd.setItemDelegate(id); QCOMPARE(fd.itemDelegate(), (QAbstractItemDelegate *)id); } diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp index a8d3c5fe1ea..e0df692ab84 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include diff --git a/tests/manual/widgets/itemviews/delegate/example.cpp b/tests/manual/widgets/itemviews/delegate/example.cpp index 3421b7790b1..9df2d87ee84 100644 --- a/tests/manual/widgets/itemviews/delegate/example.cpp +++ b/tests/manual/widgets/itemviews/delegate/example.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include @@ -16,10 +16,10 @@ public: ~ExampleEditor() { QApplication::instance()->quit(); } }; -class ExampleDelegate : public QItemDelegate +class ExampleDelegate : public QStyledItemDelegate { public: - ExampleDelegate() : QItemDelegate() + ExampleDelegate() : QStyledItemDelegate() { m_editor = new ExampleEditor(0); m_combobox = new QComboBox(0); diff --git a/util/locale_database/testlocales/localewidget.cpp b/util/locale_database/testlocales/localewidget.cpp index 50b9b81594d..c35c3dc1d8b 100644 --- a/util/locale_database/testlocales/localewidget.cpp +++ b/util/locale_database/testlocales/localewidget.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include #include -#include +#include #include #include @@ -38,7 +38,7 @@ LocaleWidget::LocaleWidget(QWidget *parent) m_model = new LocaleModel(this); m_view = new QTableView(this); - QItemDelegate *delegate = qobject_cast(m_view->itemDelegate()); + QStyledItemDelegate *delegate = qobject_cast(m_view->itemDelegate()); Q_ASSERT(delegate != 0); static EditorFactory editor_factory; delegate->setItemEditorFactory(&editor_factory);