summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTasuku Suzuki <tasuku.suzuki@kdab.com>2020-06-04 19:58:37 +0900
committerTasuku Suzuki <tasuku.suzuki@kdab.com>2020-06-08 10:30:44 +0900
commit69795835f3a578f60b16f09943feee6326087342 (patch)
tree731783999d452703f79a8a5b17406807824c77aa /src
parentbd465695c306e04d2e91fb1aee03156da7ab86cc (diff)
Fix build without features.menubar
Change-Id: If7ad6f4c50936d2abf8b88859cb3a8a6189df152 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/widgets/qmenu.cpp9
-rw-r--r--src/widgets/widgets/qmenu_p.h1
2 files changed, 9 insertions, 1 deletions
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<QPointer<QWidget> > QMenuPrivate::calcCausedStack() const
bool QMenuPrivate::isContextMenu() const
{
+#if QT_CONFIG(menubar)
return qobject_cast<const QMenuBar *>(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<QMenuBar*>(e->action()->parent())) {
+#if QT_CONFIG(menubar)
+ && !qobject_cast<QMenuBar*>(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 <QtWidgets/private/qtwidgetsglobal_p.h>
+#include "QtWidgets/qmenu.h"
#if QT_CONFIG(menubar)
#include "QtWidgets/qmenubar.h"
#endif