summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qcombobox_p.h
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-08-16 13:55:11 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-08-26 18:02:58 +0200
commitc501e09efacb8a60deb41f85f3402f6f4c041d95 (patch)
treeba3696c02eeff30279383dd618c7e39638445e37 /src/widgets/widgets/qcombobox_p.h
parent70f7c484c39dd5581160a8c3fa475ee108c4920d (diff)
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 <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/widgets/qcombobox_p.h')
-rw-r--r--src/widgets/widgets/qcombobox_p.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h
index b24c1e0ddf..9751036c53 100644
--- a/src/widgets/widgets/qcombobox_p.h
+++ b/src/widgets/widgets/qcombobox_p.h
@@ -94,13 +94,12 @@ protected:
QListView::resizeEvent(event);
}
- QStyleOptionViewItem viewOptions() const override
+ void initViewItemOption(QStyleOptionViewItem *option) const override
{
- QStyleOptionViewItem option = QListView::viewOptions();
- option.showDecorationSelected = true;
+ QListView::initViewItemOption(option);
+ option->showDecorationSelected = true;
if (combo)
- option.font = combo->font();
- return option;
+ option->font = combo->font();
}
void paintEvent(QPaintEvent *e) override