From 24d60cb64d2d2d677612d8f517031b38c685ee7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lund=20Martsum?= Date: Wed, 15 Jul 2020 09:24:20 +0200 Subject: Make initStyleOption virtual for various classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Thorbjørn Lund Martsum --- src/widgets/widgets/qmenu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets/widgets/qmenu.h') 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(); -- cgit v1.2.3