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/widgets/qmenu.h | |
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/widgets/qmenu.h')
-rw-r--r-- | src/widgets/widgets/qmenu.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h index b770b27957..e8b27c3278 100644 --- a/src/widgets/widgets/qmenu.h +++ b/src/widgets/widgets/qmenu.h @@ -257,7 +257,7 @@ protected: void timerEvent(QTimerEvent *) override; bool event(QEvent *) override; bool focusNextPrevChild(bool next) override; - void initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const; + virtual void initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const; private Q_SLOTS: void internalDelayedPopup(); |