From 69795835f3a578f60b16f09943feee6326087342 Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Thu, 4 Jun 2020 19:58:37 +0900 Subject: [PATCH] Fix build without features.menubar Change-Id: If7ad6f4c50936d2abf8b88859cb3a8a6189df152 Reviewed-by: Volker Hilsheimer --- src/widgets/widgets/qmenu.cpp | 9 ++++++++- src/widgets/widgets/qmenu_p.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 9823f01666..7b72379d40 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -352,7 +352,11 @@ QVector > QMenuPrivate::calcCausedStack() const bool QMenuPrivate::isContextMenu() const { +#if QT_CONFIG(menubar) return qobject_cast(topCausedWidget()) == nullptr; +#else + return true; +#endif } void QMenuPrivate::updateActionRects() const @@ -3566,7 +3570,10 @@ void QMenu::actionEvent(QActionEvent *e) if (e->type() == QEvent::ActionAdded) { if (!d->tornoff - && !qobject_cast(e->action()->parent())) { +#if QT_CONFIG(menubar) + && !qobject_cast(e->action()->parent()) +#endif + ) { // Only connect if the action was not directly added by QMenuBar::addAction(const QString &text) // to avoid the signal being emitted twice connect(e->action(), SIGNAL(triggered()), this, SLOT(_q_actionTriggered()), Qt::UniqueConnection); diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h index 3871d6763c..e735052507 100644 --- a/src/widgets/widgets/qmenu_p.h +++ b/src/widgets/widgets/qmenu_p.h @@ -52,6 +52,7 @@ // #include +#include "QtWidgets/qmenu.h" #if QT_CONFIG(menubar) #include "QtWidgets/qmenubar.h" #endif