summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets
diff options
context:
space:
mode:
authorStephan Binner <stephan.binner@basyskom.com>2017-08-27 19:06:42 +0200
committerStephan Binner <stephan.binner@basyskom.com>2017-09-04 06:40:14 +0000
commit314a591461c58addd2805e0b4dc2cdb4308d5d31 (patch)
treedb353751ef969c00d9649c7c424c14d06ca83472 /src/widgets/widgets
parentb649717784368f04e61f5bc240c052c5c4744a2c (diff)
Convert features.menubar to QT_[REQUIRE_]CONFIG
Change-Id: Idbd4978852fa280dd18a5684469d499da3892126 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r--src/widgets/widgets/qmainwindow.cpp9
-rw-r--r--src/widgets/widgets/qmainwindow.h2
-rw-r--r--src/widgets/widgets/qmdiarea.cpp1
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp39
-rw-r--r--src/widgets/widgets/qmdisubwindow_p.h8
-rw-r--r--src/widgets/widgets/qmenu.cpp28
-rw-r--r--src/widgets/widgets/qmenu_mac.mm6
-rw-r--r--src/widgets/widgets/qmenu_p.h2
-rw-r--r--src/widgets/widgets/qmenubar.cpp6
-rw-r--r--src/widgets/widgets/qmenubar.h7
-rw-r--r--src/widgets/widgets/qmenubar_p.h5
-rw-r--r--src/widgets/widgets/qtoolbar.cpp2
-rw-r--r--src/widgets/widgets/widgets.pri11
13 files changed, 68 insertions, 58 deletions
diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp
index c76d3cb445..9337595ead 100644
--- a/src/widgets/widgets/qmainwindow.cpp
+++ b/src/widgets/widgets/qmainwindow.cpp
@@ -50,7 +50,10 @@
#include "qtoolbar.h"
#include <qapplication.h>
+#include <qmenu.h>
+#if QT_CONFIG(menubar)
#include <qmenubar.h>
+#endif
#if QT_CONFIG(statusbar)
#include <qstatusbar.h>
#endif
@@ -520,7 +523,7 @@ void QMainWindow::setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle)
emit toolButtonStyleChanged(d->toolButtonStyle);
}
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
/*!
Returns the menu bar for the main window. This function creates
and returns an empty menu bar if the menu bar does not exist.
@@ -607,7 +610,7 @@ void QMainWindow::setMenuWidget(QWidget *menuBar)
}
d->layout->setMenuBar(menuBar);
}
-#endif // QT_NO_MENUBAR
+#endif // QT_CONFIG(menubar)
#if QT_CONFIG(statusbar)
/*!
@@ -1663,7 +1666,7 @@ void QMainWindow::contextMenuEvent(QContextMenuEvent *event)
// children and for the menu bar as well
QWidget *child = childAt(event->pos());
while (child && child != this) {
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar *>(child)) {
if (mb->parentWidget() != this)
return;
diff --git a/src/widgets/widgets/qmainwindow.h b/src/widgets/widgets/qmainwindow.h
index e0592d2c3f..ff489efa2d 100644
--- a/src/widgets/widgets/qmainwindow.h
+++ b/src/widgets/widgets/qmainwindow.h
@@ -123,7 +123,7 @@ public:
bool isSeparator(const QPoint &pos) const;
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
QMenuBar *menuBar() const;
void setMenuBar(QMenuBar *menubar);
diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp
index 513011f0ad..36b3828576 100644
--- a/src/widgets/widgets/qmdiarea.cpp
+++ b/src/widgets/widgets/qmdiarea.cpp
@@ -173,6 +173,7 @@
#include <QDesktopWidget>
#include <QDebug>
#include <qmath.h>
+#include <qmenu.h>
#include <private/qlayoutengine_p.h>
#include <algorithm>
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index 663572802c..0abc4967e1 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -165,6 +165,7 @@
#endif
#include <QMdiArea>
#include <QScopedValueRollback>
+#include <QMenu>
QT_BEGIN_NAMESPACE
@@ -703,7 +704,7 @@ ControlContainer::ControlContainer(QMdiSubWindow *mdiChild)
: QObject(mdiChild),
previousLeft(0),
previousRight(0),
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
m_menuBar(0),
#endif
mdiChild(mdiChild)
@@ -725,7 +726,7 @@ ControlContainer::ControlContainer(QMdiSubWindow *mdiChild)
ControlContainer::~ControlContainer()
{
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
removeButtonsFromMenuBar();
#endif
delete m_menuLabel;
@@ -734,7 +735,7 @@ ControlContainer::~ControlContainer()
m_controllerWidget = 0;
}
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
/*
\internal
*/
@@ -846,7 +847,7 @@ void ControlContainer::removeButtonsFromMenuBar(QMenuBar *menuBar)
mdiChild->window()->setWindowTitle(mdiChild->d_func()->originalWindowTitle());
}
-#endif // QT_NO_MENUBAR
+#endif // QT_CONFIG(menubar)
void ControlContainer::updateWindowIcon(const QIcon &windowIcon)
{
@@ -1268,7 +1269,7 @@ void QMdiSubWindowPrivate::setNormalMode()
isMaximizeMode = false;
ensureWindowState(Qt::WindowNoState);
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
removeButtonsFromMenuBar();
#endif
@@ -1375,7 +1376,7 @@ void QMdiSubWindowPrivate::setMaximizeMode()
updateGeometryConstraints();
if (wasVisible) {
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *mBar = menuBar())
showButtonsInMenuBar(mBar);
else
@@ -1438,7 +1439,7 @@ void QMdiSubWindowPrivate::setActive(bool activate, bool changeFocus)
Qt::WindowStates oldWindowState = q->windowState();
ensureWindowState(Qt::WindowActive);
emit q->aboutToActivate();
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *mBar = menuBar())
showButtonsInMenuBar(mBar);
#endif
@@ -1783,7 +1784,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const
#else
if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, 0, q))
return true;
-#if defined(QT_NO_MENUBAR) || defined(QT_NO_MAINWINDOW)
+#if !QT_CONFIG(menubar) || defined(QT_NO_MAINWINDOW)
Q_UNUSED(isChildOfQMdiSubWindow);
return true;
#else
@@ -1797,7 +1798,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const
#endif
}
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
/*!
\internal
@@ -1868,7 +1869,7 @@ void QMdiSubWindowPrivate::removeButtonsFromMenuBar()
originalTitle.clear();
}
-#endif // QT_NO_MENUBAR
+#endif // QT_CONFIG(menubar)
void QMdiSubWindowPrivate::updateWindowTitle(bool isRequestFromChild)
{
@@ -2295,7 +2296,7 @@ QMdiSubWindow::QMdiSubWindow(QWidget *parent, Qt::WindowFlags flags)
QMdiSubWindow::~QMdiSubWindow()
{
Q_D(QMdiSubWindow);
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
d->removeButtonsFromMenuBar();
#endif
d->setActive(false);
@@ -2628,7 +2629,7 @@ void QMdiSubWindow::showShaded()
d->ensureWindowState(Qt::WindowMinimized);
}
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
d->removeButtonsFromMenuBar();
#endif
@@ -2768,7 +2769,7 @@ bool QMdiSubWindow::eventFilter(QObject *object, QEvent *event)
if (object == d->baseWidget) {
d->updateWindowTitle(true);
d->lastChildWindowTitle = d->baseWidget->windowTitle();
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
} else if (maximizedButtonsWidget() && d->controlContainer->menuBar() && d->controlContainer->menuBar()
->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()) {
d->originalTitle.clear();
@@ -2831,7 +2832,7 @@ bool QMdiSubWindow::event(QEvent *event)
break;
case QEvent::ParentChange: {
bool wasResized = testAttribute(Qt::WA_Resized);
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
d->removeButtonsFromMenuBar();
#endif
d->currentOperation = QMdiSubWindowPrivate::None;
@@ -2888,12 +2889,12 @@ bool QMdiSubWindow::event(QEvent *event)
case QEvent::ModifiedChange:
if (!windowTitle().contains(QLatin1String("[*]")))
break;
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (maximizedButtonsWidget() && d->controlContainer->menuBar() && d->controlContainer->menuBar()
->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()) {
window()->setWindowModified(isWindowModified());
}
-#endif // QT_NO_MENUBAR
+#endif // QT_CONFIG(menubar)
d->updateInternalWindowTitle();
break;
case QEvent::LayoutDirectionChange:
@@ -2956,7 +2957,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent)
d->updateDirtyRegions();
// Show buttons in the menu bar if they're already not there.
// We want to do this when QMdiSubWindow becomes visible after being hidden.
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (d->controlContainer) {
if (QMenuBar *menuBar = d->menuBar()) {
if (menuBar->cornerWidget(Qt::TopRightCorner) != maximizedButtonsWidget())
@@ -2972,7 +2973,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent)
*/
void QMdiSubWindow::hideEvent(QHideEvent * /*hideEvent*/)
{
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
d_func()->removeButtonsFromMenuBar();
#endif
}
@@ -3046,7 +3047,7 @@ void QMdiSubWindow::closeEvent(QCloseEvent *closeEvent)
closeEvent->ignore();
return;
}
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
d->removeButtonsFromMenuBar();
#endif
d->setActive(false);
diff --git a/src/widgets/widgets/qmdisubwindow_p.h b/src/widgets/widgets/qmdisubwindow_p.h
index 71fcc38378..51652a78ff 100644
--- a/src/widgets/widgets/qmdisubwindow_p.h
+++ b/src/widgets/widgets/qmdisubwindow_p.h
@@ -58,7 +58,9 @@
#include <QStyle>
#include <QStyleOptionTitleBar>
+#if QT_CONFIG(menubar)
#include <QMenuBar>
+#endif
#include <QSizeGrip>
#include <QPointer>
#include <QDebug>
@@ -96,7 +98,7 @@ public:
ControlContainer(QMdiSubWindow *mdiChild);
~ControlContainer();
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
void showButtonsInMenuBar(QMenuBar *menuBar);
void removeButtonsFromMenuBar(QMenuBar *menuBar = 0);
QMenuBar *menuBar() const { return m_menuBar; }
@@ -108,7 +110,7 @@ public:
private:
QPointer<QWidget> previousLeft;
QPointer<QWidget> previousRight;
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
QPointer<QMenuBar> m_menuBar;
#endif
QPointer<QWidget> m_controllerWidget;
@@ -252,7 +254,7 @@ public:
int titleBarHeight(const QStyleOptionTitleBar &options) const;
void sizeParameters(int *margin, int *minWidth) const;
bool drawTitleBarWhenMaximized() const;
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
QMenuBar *menuBar() const;
void showButtonsInMenuBar(QMenuBar *menuBar);
void removeButtonsFromMenuBar();
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 9b2856a728..93ceca1095 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -64,7 +64,9 @@
#endif
#include "qmenu_p.h"
+#if QT_CONFIG(menubar)
#include "qmenubar_p.h"
+#endif
#include "qwidgetaction.h"
#if QT_CONFIG(toolbutton)
#include "qtoolbutton.h"
@@ -491,7 +493,7 @@ void QMenuPrivate::hideUpToMenuBar()
QWidget *caused = causedPopup.widget;
hideMenu(q); //hide after getting causedPopup
while(caused) {
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
mb->d_func()->setCurrentAction(0);
mb->d_func()->setKeyboardMode(false);
@@ -1273,7 +1275,7 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
bool passOnEvent = false;
QWidget *next_widget = 0;
QPoint cpos = caused->mapFromGlobal(e->globalPos());
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
passOnEvent = mb->rect().contains(cpos);
} else
@@ -1315,7 +1317,7 @@ void QMenuPrivate::activateCausedStack(const QVector<QPointer<QWidget> > &caused
} else if (action_e == QAction::Hover) {
emit qmenu->hovered(action);
}
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
} else if (QMenuBar *qmenubar = qobject_cast<QMenuBar*>(widget)) {
if (action_e == QAction::Trigger) {
emit qmenubar->triggered(action);
@@ -1410,7 +1412,7 @@ void QMenuPrivate::_q_actionTriggered()
QVector< QPointer<QWidget> > list;
for(QWidget *widget = q->parentWidget(); widget; ) {
if (qobject_cast<QMenu*>(widget)
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
|| qobject_cast<QMenuBar*>(widget)
#endif
) {
@@ -2310,7 +2312,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
d->doChildEffects = true;
d->updateLayoutDirection();
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
// if this menu is part of a chain attached to a QMenuBar, set the
// _NET_WM_WINDOW_TYPE_DROPDOWN_MENU X11 window type
setAttribute(Qt::WA_X11NetWmWindowTypeDropDownMenu, qobject_cast<QMenuBar *>(d->topCausedWidget()) != 0);
@@ -2406,11 +2408,11 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
if (snapToMouse) // position flowing left from the mouse
pos.setX(mouse.x() - size.width());
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
// if the menu is in a menubar or is a submenu, it should be right-aligned
if (qobject_cast<QMenuBar*>(d->causedPopup.widget) || qobject_cast<QMenu*>(d->causedPopup.widget))
pos.rx() -= size.width();
-#endif //QT_NO_MENUBAR
+#endif // QT_CONFIG(menubar)
if (pos.x() < screen.left() + desktopFrame)
pos.setX(qMax(p.x(), screen.left() + desktopFrame));
@@ -2486,7 +2488,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
hGuess = QEffects::LeftScroll;
}
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if ((snapToMouse && (pos.y() + size.height() / 2 < mouse.y())) ||
(qobject_cast<QMenuBar*>(d->causedPopup.widget) &&
pos.y() + size.width() / 2 < d->causedPopup.widget->mapToGlobal(d->causedPopup.widget->pos()).y()))
@@ -2494,7 +2496,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
#endif
if (QApplication::isEffectEnabled(Qt::UI_AnimateMenu)) {
bool doChildEffects = true;
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->causedPopup.widget)) {
doChildEffects = mb->d_func()->doChildEffects;
mb->d_func()->doChildEffects = false;
@@ -2656,7 +2658,7 @@ void QMenu::hideEvent(QHideEvent *)
QAccessibleEvent event(this, QAccessible::PopupMenuEnd);
QAccessible::updateAccessibility(&event);
#endif
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->causedPopup.widget))
mb->d_func()->setCurrentAction(0);
#endif
@@ -3204,7 +3206,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
if (style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, this))
{
d->hideMenu(this);
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(QApplication::focusWidget())) {
mb->d_func()->setKeyboardMode(false);
}
@@ -3266,7 +3268,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
{
QPointer<QWidget> caused = d->causedPopup.widget;
d->hideMenu(this); // hide after getting causedPopup
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
mb->d_func()->setCurrentAction(d->menuAction);
mb->d_func()->setKeyboardMode(true);
@@ -3343,7 +3345,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
}
}
if (!key_consumed) {
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->topCausedWidget())) {
QAction *oldAct = mb->d_func()->currentAction;
QApplication::sendEvent(mb, e);
diff --git a/src/widgets/widgets/qmenu_mac.mm b/src/widgets/widgets/qmenu_mac.mm
index f9f3ad08dc..65b7030e20 100644
--- a/src/widgets/widgets/qmenu_mac.mm
+++ b/src/widgets/widgets/qmenu_mac.mm
@@ -41,8 +41,10 @@
#import <AppKit/AppKit.h>
#include "qmenu.h"
+#if QT_CONFIG(menubar)
#include "qmenubar.h"
#include "qmenubar_p.h"
+#endif
#include "qmacnativewidget_mac.h"
#include <QtCore/QDebug>
@@ -139,7 +141,7 @@ void QMenuPrivate::moveWidgetToPlatformItem(QWidget *widget, QPlatformMenuItem*
#endif //QT_NO_MENU
-#ifndef QT_NO_MENUBAR
+#if QT_CONFIG(menubar)
/*!
\since 5.2
@@ -159,7 +161,7 @@ NSMenu *QMenuBar::toNSMenu()
}
return nil;
}
-#endif //QT_NO_MENUBAR
+#endif // QT_CONFIG(menubar)
QT_END_NAMESPACE
diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h
index 40cbb3b891..65975da984 100644
--- a/src/widgets/widgets/qmenu_p.h
+++ b/src/widgets/widgets/qmenu_p.h
@@ -52,7 +52,9 @@
//
#include <QtWidgets/private/qtwidgetsglobal_p.h>
+#if QT_CONFIG(menubar)
#include "QtWidgets/qmenubar.h"
+#endif
#include "QtWidgets/qstyleoption.h"
#include "QtCore/qdatetime.h"
#include "QtCore/qmap.h"
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index fd48058ec3..a78195d2aa 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -61,9 +61,6 @@
#include "private/qguiapplication_p.h"
#include "qpa/qplatformintegration.h"
-#ifndef QT_NO_MENUBAR
-
-
#include "qmenu_p.h"
#include "qmenubar_p.h"
#include "qdebug.h"
@@ -1874,9 +1871,6 @@ QPlatformMenuBar *QMenuBar::platformMenuBar()
// for private slots
-
QT_END_NAMESPACE
#include <moc_qmenubar.cpp>
-
-#endif // QT_NO_MENUBAR
diff --git a/src/widgets/widgets/qmenubar.h b/src/widgets/widgets/qmenubar.h
index 7ad205b77a..be70f4ea48 100644
--- a/src/widgets/widgets/qmenubar.h
+++ b/src/widgets/widgets/qmenubar.h
@@ -43,10 +43,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qmenu.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(menubar);
-#ifndef QT_NO_MENUBAR
+QT_BEGIN_NAMESPACE
class QMenuBarPrivate;
class QStyleOptionMenuItem;
@@ -140,8 +139,6 @@ private:
friend class QWindowsStyle;
};
-#endif // QT_NO_MENUBAR
-
QT_END_NAMESPACE
#endif // QMENUBAR_H
diff --git a/src/widgets/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h
index f5409b9762..01d8793a3a 100644
--- a/src/widgets/widgets/qmenubar_p.h
+++ b/src/widgets/widgets/qmenubar_p.h
@@ -56,9 +56,10 @@
#include <private/qmenu_p.h> // Mac needs what in this file!
#include <qpa/qplatformmenu.h>
+QT_REQUIRE_CONFIG(menubar);
+
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_MENUBAR
class QMenuBarExtension;
class QMenuBarPrivate : public QWidgetPrivate
{
@@ -136,8 +137,6 @@ public:
inline int indexOf(QAction *act) const { return q_func()->actions().indexOf(act); }
};
-#endif // QT_NO_MENUBAR
-
QT_END_NAMESPACE
#endif // QMENUBAR_P_H
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index b5c2179bcc..663e8214c0 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -49,7 +49,9 @@
#include <qlayout.h>
#include <qmainwindow.h>
#include <qmenu.h>
+#if QT_CONFIG(menubar)
#include <qmenubar.h>
+#endif
#if QT_CONFIG(rubberband)
#include <qrubberband.h>
#endif
diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri
index a3f7061c4f..48d3dd96d5 100644
--- a/src/widgets/widgets/widgets.pri
+++ b/src/widgets/widgets/widgets.pri
@@ -19,8 +19,6 @@ HEADERS += \
widgets/qmdisubwindow_p.h \
widgets/qmenu.h \
widgets/qmenu_p.h \
- widgets/qmenubar.h \
- widgets/qmenubar_p.h \
widgets/qscrollarea_p.h \
widgets/qsizegrip.h \
widgets/qslider.h \
@@ -55,7 +53,6 @@ SOURCES += \
widgets/qmdiarea.cpp \
widgets/qmdisubwindow.cpp \
widgets/qmenu.cpp \
- widgets/qmenubar.cpp \
widgets/qsizegrip.cpp \
widgets/qslider.cpp \
widgets/qspinbox.cpp \
@@ -171,6 +168,14 @@ qtConfig(lcdnumber) {
widgets/qlcdnumber.cpp
}
+qtConfig(menubar) {
+ HEADERS += \
+ widgets/qmenubar.h \
+ widgets/qmenubar_p.h
+
+ SOURCES += widgets/qmenubar.cpp
+}
+
qtConfig(progressbar) {
HEADERS += widgets/qprogressbar.h
SOURCES += widgets/qprogressbar.cpp