diff options
author | Thorbjørn Lund Martsum <tmartsum@gmail.com> | 2020-07-15 09:24:20 +0200 |
---|---|---|
committer | Thorbjørn Lund Martsum <tmartsum@gmail.com> | 2020-07-31 14:58:54 +0200 |
commit | 24d60cb64d2d2d677612d8f517031b38c685ee7b (patch) | |
tree | b453a9a0b1a5d47aef4ae13ea08291f4e13f65f5 /src/widgets/itemviews/qheaderview.cpp | |
parent | 9c0f448f5a4e2e96e9b801c751c0a145c0eb6dad (diff) |
Make initStyleOption virtual for various classes
Often a simple change in the styleoptions is needed in e.g a paintEvent,
but it was impossible without copying the whole paint-function which
is not always trivial and also wouldn't be kept up-to-date if it was
changed in Qt.
The initStyleOption is similar to viewOptions in QAbstractTableView
and it is handy that this function is virtual. Furthermore
QStyledItemDelegate::initStyleOption is already virtual.
This change only makes initStyleOption virtual for public classes.
[ChangeLog][QtWidgets] InitStyleOption has been made virtual in
public Qt classes to make override of stylebehavior more simple.
Change-Id: I38974c6d4dd0793ca5976ecf3aa28892215a1579
Task-number: QTBUG-77642
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Diffstat (limited to 'src/widgets/itemviews/qheaderview.cpp')
-rw-r--r-- | src/widgets/itemviews/qheaderview.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 3c5469f128..fcb74370c7 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -3385,6 +3385,14 @@ void QHeaderView::initStyleOption(QStyleOptionHeader *option) const option->section = 0; } +void QHeaderView::initStyleOption(QStyleOptionFrame *option) const +{ + // The QFrame version is only here to avoid compiler warnings. + // If invoked (it can be invoked with QFrame *f = headerview; f->initStyleOption()), + // and here we just pass it on to the frame version. + QFrame::initStyleOption(option); +} + bool QHeaderViewPrivate::isSectionSelected(int section) const { int i = section * 2; |