From c501e09efacb8a60deb41f85f3402f6f4c041d95 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Sun, 16 Aug 2020 13:55:11 +0200 Subject: Replace QAbstractItemView::viewOptions with initViewItemOption viewOptions returned a QStyleOptionViewItem object. Such a method can never support newer versions of the option structure. Most styleable QWidget classes provide a virtual method initStyleOption that initializes the option object passed in as a pointer, e.g QFrame, QAbstractSpinBox, or QComboBox. Follow that API convention, but name it initViewItemOption, as the QStyleOptionViewItem struct contains information about the item as well as the widget itelf. This is a source incompatible change that will go unnoticed unless existing subclasses mark their overrides as 'override', or call the removed QAbstractItemView::viewOption virtual function. [ChangeLog][QtWidgets][QAbstractItemView] The virtual viewOptions method that previously returned a QStyleOptionViewItem object has been renamed to initViewItemOption, and initializes a QStyleOptionViewItem object that's passed in through a pointer. Change-Id: Ie058702aed42d77274fa3c4abb43ba302e57e348 Reviewed-by: Richard Moe Gustavsen --- tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests/auto/widgets/itemviews/qitemdelegate') diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp index 36ab1a64a6..155b5389fc 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp @@ -843,7 +843,9 @@ class FastEditItemView : public QTableView public: QWidget* fastEdit(const QModelIndex &i) // Consider this as QAbstractItemView::edit( ) { - QWidget *v = itemDelegate()->createEditor(viewport(), viewOptions(), i); + QStyleOptionViewItem option; + initViewItemOption(&option); + QWidget *v = itemDelegate()->createEditor(viewport(), option, i); if (v) itemDelegate()->setEditorData(v, i); return v; -- cgit v1.2.3