Fix build without features.menubar

Change-Id: If7ad6f4c50936d2abf8b88859cb3a8a6189df152
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Tasuku Suzuki 2020-06-04 19:58:37 +09:00
parent bd465695c3
commit 69795835f3
2 changed files with 9 additions and 1 deletions

View File

@ -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);

View File

@ -52,6 +52,7 @@
//
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtWidgets/qmenu.h"
#if QT_CONFIG(menubar)
#include "QtWidgets/qmenubar.h"
#endif