From 9e95c89118cb0404eac575b40f97d8439f704bc7 Mon Sep 17 00:00:00 2001 From: Darcy Shen Date: Tue, 19 Jun 2018 18:17:47 +0000 Subject: [PATCH] fix as QTBUG-65578 indicates --- src/src/Plugins/Qt/QTMMenuHelper.cpp | 11 +++++------ src/src/Plugins/Qt/QTMMenuHelper.hpp | 21 --------------------- 3 files changed, 6 insertions(+), 27 deletions(-) diff --git a/src/src/Plugins/Qt/QTMMenuHelper.cpp b/src/src/Plugins/Qt/QTMMenuHelper.cpp index 5f7ae7d47..d1646d7c3 100644 --- a/src/src/Plugins/Qt/QTMMenuHelper.cpp +++ b/src/src/Plugins/Qt/QTMMenuHelper.cpp @@ -241,8 +241,6 @@ QTMMinibarAction::createWidget (QWidget* parent) { ******************************************************************************/ QTMMenuButton::QTMMenuButton (QWidget* parent) : QToolButton (parent) { - QTMAuxMenu m; - m.myInitStyleOption (&option); setAttribute (Qt::WA_Hover); } @@ -267,11 +265,13 @@ QTMMenuButton::mouseReleaseEvent (QMouseEvent* e) { void QTMMenuButton::paintEvent (QPaintEvent* e) { (void) e; - QPainter p (this); // initialize the options QStyleOptionToolButton opt; initStyleOption (&opt); + + QPainter p (this); + QStyleOptionToolButton option; QRect r = rect(); option.rect = r; option.state = QStyle::State_Enabled | (opt.state & QStyle::State_MouseOver @@ -289,14 +289,13 @@ QTMMenuButton::paintEvent (QPaintEvent* e) { ******************************************************************************/ QTMMenuWidget::QTMMenuWidget (QWidget* parent) : QWidget (parent) { - QTMAuxMenu m; - m.myInitStyleOption (&option); } void QTMMenuWidget::paintEvent(QPaintEvent* e) { QPainter p (this); - option.rect = rect (); + QStyleOptionMenuItem option; + option.rect = rect(); style()->drawControl (QStyle::CE_MenuEmptyArea, &option, &p, this); QWidget::paintEvent (e); } diff --git a/src/src/Plugins/Qt/QTMMenuHelper.hpp b/src/src/Plugins/Qt/QTMMenuHelper.hpp index 7a3098c87..8dfb319eb 100644 --- a/src/src/Plugins/Qt/QTMMenuHelper.hpp +++ b/src/src/Plugins/Qt/QTMMenuHelper.hpp @@ -188,23 +188,6 @@ class QTMMinibarAction : public QWidgetAction { }; -/*! - We use this class to properly initialize style options for our QWidgets - which have to blend into QMenus. See #QTBUG-1993 and #QTBUG-7707. - */ -class QTMAuxMenu : public QMenu { - Q_OBJECT - -public: - QTMAuxMenu() : QMenu() { } - - void myInitStyleOption (QStyleOptionMenuItem* option) const { - QAction action (NULL); - initStyleOption (option, &action); - } -}; - - /*! QTMMenuButton is a custom button appropriate for menus. We need to subclass QToolButton for two reasons: @@ -215,8 +198,6 @@ class QTMAuxMenu : public QMenu { class QTMMenuButton: public QToolButton { Q_OBJECT - QStyleOptionMenuItem option; - public: QTMMenuButton (QWidget* parent = NULL); @@ -231,8 +212,6 @@ class QTMMenuButton: public QToolButton { class QTMMenuWidget: public QWidget { Q_OBJECT - QStyleOptionMenuItem option; - public: QTMMenuWidget (QWidget* parent = NULL); void paintEvent(QPaintEvent *event);