summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Binner <stephan.binner@basyskom.com>2017-08-27 19:07:31 +0200
committerPaul Olav Tvete <paul.tvete@qt.io>2018-05-02 09:07:03 +0000
commit364bd6ca74b059ffe8ae367e1562645a3ed0855e (patch)
treede86fa29ad2835030603e39c5fac2b0f186ad8c9
parent3761d99512244ae167a66e6894c75eb2ef1cca48 (diff)
Convert features.toolbar to QT_[REQUIRE_]CONFIG
Move declaration of pick/perp helpers up the dependency chain Change-Id: I7084ed829a057a0c45d60445c416fb07f2cb5624 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac_p_p.h2
-rw-r--r--src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h2
-rw-r--r--src/plugins/styles/windowsvista/qwindowsxpstyle.cpp6
-rw-r--r--src/widgets/kernel/qlayout.cpp2
-rw-r--r--src/widgets/kernel/qlayoutitem.cpp2
-rw-r--r--src/widgets/statemachine/qguistatemachine.cpp4
-rw-r--r--src/widgets/styles/qcommonstyle.cpp22
-rw-r--r--src/widgets/styles/qstyleoption.cpp2
-rw-r--r--src/widgets/styles/qstyleoption.h4
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp14
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp8
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp1
-rw-r--r--src/widgets/widgets/qmainwindow.cpp18
-rw-r--r--src/widgets/widgets/qmainwindow.h6
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp77
-rw-r--r--src/widgets/widgets/qmainwindowlayout_p.h6
-rw-r--r--src/widgets/widgets/qmenu_p.h27
-rw-r--r--src/widgets/widgets/qmenubar.cpp2
-rw-r--r--src/widgets/widgets/qpushbutton.cpp4
-rw-r--r--src/widgets/widgets/qtoolbar.cpp4
-rw-r--r--src/widgets/widgets/qtoolbar.h7
-rw-r--r--src/widgets/widgets/qtoolbar_p.h6
-rw-r--r--src/widgets/widgets/qtoolbararealayout.cpp4
-rw-r--r--src/widgets/widgets/qtoolbararealayout_p.h35
-rw-r--r--src/widgets/widgets/qtoolbarlayout.cpp4
-rw-r--r--src/widgets/widgets/qtoolbarlayout_p.h6
-rw-r--r--src/widgets/widgets/qtoolbarseparator.cpp4
-rw-r--r--src/widgets/widgets/qtoolbarseparator_p.h6
-rw-r--r--src/widgets/widgets/qtoolbutton.cpp12
-rw-r--r--src/widgets/widgets/widgets.pri28
30 files changed, 168 insertions, 157 deletions
diff --git a/src/plugins/styles/mac/qmacstyle_mac_p_p.h b/src/plugins/styles/mac/qmacstyle_mac_p_p.h
index 4eac0a59d6..8c712e838a 100644
--- a/src/plugins/styles/mac/qmacstyle_mac_p_p.h
+++ b/src/plugins/styles/mac/qmacstyle_mac_p_p.h
@@ -110,7 +110,9 @@
#include <qstyleoption.h>
#include <qtextedit.h>
#include <qtextstream.h>
+#if QT_CONFIG(toolbar)
#include <qtoolbar.h>
+#endif
#if QT_CONFIG(toolbutton)
#include <qtoolbutton.h>
#endif
diff --git a/src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h b/src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h
index b649426811..d66b17e9f8 100644
--- a/src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h
+++ b/src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h
@@ -75,7 +75,9 @@
#if QT_CONFIG(spinbox)
#include <qspinbox.h>
#endif
+#if QT_CONFIG(toolbar)
#include <qtoolbar.h>
+#endif
#if QT_CONFIG(combobox)
#include <qcombobox.h>
#endif
diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp
index 733b3a9e9c..9d2e770191 100644
--- a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp
+++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp
@@ -79,7 +79,9 @@
#if QT_CONFIG(pushbutton)
#include <qpushbutton.h>
#endif
+#if QT_CONFIG(toolbar)
#include <qtoolbar.h>
+#endif
#include <qlabel.h>
#include <qvarlengtharray.h>
#include <qdebug.h>
@@ -3311,12 +3313,12 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con
res = 160;
break;
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
case PM_ToolBarHandleExtent:
res = int(QStyleHelper::dpiScaled(8.));
break;
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
case PM_DockWidgetSeparatorExtent:
case PM_DockWidgetTitleMargin:
res = int(QStyleHelper::dpiScaled(4.));
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index f3db4f4e2d..9ce1c1c2d4 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -44,7 +44,9 @@
#if QT_CONFIG(menubar)
#include "qmenubar.h"
#endif
+#if QT_CONFIG(toolbar)
#include "qtoolbar.h"
+#endif
#if QT_CONFIG(sizegrip)
#include "qsizegrip.h"
#endif
diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp
index 52640daf55..25890e888b 100644
--- a/src/widgets/kernel/qlayoutitem.cpp
+++ b/src/widgets/kernel/qlayoutitem.cpp
@@ -44,7 +44,9 @@
#if QT_CONFIG(menubar)
#include "qmenubar.h"
#endif
+#if QT_CONFIG(toolbar)
#include "qtoolbar.h"
+#endif
#include "qevent.h"
#include "qstyle.h"
#include "qvariant.h"
diff --git a/src/widgets/statemachine/qguistatemachine.cpp b/src/widgets/statemachine/qguistatemachine.cpp
index b452c63551..130260704f 100644
--- a/src/widgets/statemachine/qguistatemachine.cpp
+++ b/src/widgets/statemachine/qguistatemachine.cpp
@@ -251,10 +251,10 @@ static QEvent *cloneEvent(QEvent *e)
return new QWhatsThisClickedEvent(*static_cast<QWhatsThisClickedEvent*>(e));
#endif // QT_CONFIG(whatsthis)
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
case QEvent::ToolBarChange:
return new QToolBarChangeEvent(*static_cast<QToolBarChangeEvent*>(e));
-#endif //QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
case QEvent::ApplicationActivate:
return new QEvent(*e);
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 557277b9e0..7420bfb3f7 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -81,7 +81,9 @@
#if QT_CONFIG(tabwidget)
#include <qtabwidget.h>
#endif
+#if QT_CONFIG(toolbar)
#include <qtoolbar.h>
+#endif
#if QT_CONFIG(toolbutton)
#include <qtoolbutton.h>
#endif
@@ -276,7 +278,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
}
}
break;
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
case PE_PanelMenuBar:
if (widget && qobject_cast<QToolBar *>(widget->parentWidget()))
break;
@@ -295,7 +297,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
break;
case PE_PanelToolBar:
break;
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
#if QT_CONFIG(progressbar)
case PE_IndicatorProgressChunk:
{
@@ -477,7 +479,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
}
break;
#endif // QT_CONFIG(dockwidget)
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
case PE_IndicatorToolBarHandle:
p->save();
p->translate(opt->rect.x(), opt->rect.y());
@@ -515,7 +517,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
qDrawShadeLine(p, p1, p2, opt->palette, 1, 1, 0);
break;
}
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
#if QT_CONFIG(spinbox)
case PE_IndicatorSpinPlus:
case PE_IndicatorSpinMinus: {
@@ -2153,7 +2155,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
}
break;
#endif // QT_CONFIG(combobox)
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
case CE_ToolBar:
if (const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
// Compatibility with styles that use PE_PanelToolBar
@@ -2169,7 +2171,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
&toolBar->palette.brush(QPalette::Button));
}
break;
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
case CE_ColumnViewGrip: {
// draw background gradients
QLinearGradient g(0, 0, opt->rect.width(), 0);
@@ -3072,7 +3074,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
}
break;
#endif // QT_CONFIG(itemviews)
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
case SE_ToolBarHandle:
if (const QStyleOptionToolBar *tbopt = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
if (tbopt->features & QStyleOptionToolBar::Movable) {
@@ -3090,7 +3092,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
}
}
break;
-#endif //QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
default:
break;
}
@@ -4570,7 +4572,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
ret = 0;
break;
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
case PM_ToolBarFrameWidth:
ret = 1;
break;
@@ -4594,7 +4596,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
case PM_ToolBarExtensionExtent:
ret = int(QStyleHelper::dpiScaled(12.));
break;
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
#if QT_CONFIG(tabbar)
case PM_TabBarTabOverlap:
diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp
index 3666bce205..e7fa26e2d4 100644
--- a/src/widgets/styles/qstyleoption.cpp
+++ b/src/widgets/styles/qstyleoption.cpp
@@ -1040,7 +1040,7 @@ QStyleOptionButton::QStyleOptionButton(int version)
*/
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
/*!
\class QStyleOptionToolBar
\brief The QStyleOptionToolBar class is used to describe the
diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h
index 2880917510..9fbaf34a86 100644
--- a/src/widgets/styles/qstyleoption.h
+++ b/src/widgets/styles/qstyleoption.h
@@ -296,7 +296,7 @@ typedef Q_DECL_DEPRECATED QStyleOptionTab QStyleOptionTabV3;
#endif // QT_CONFIG(tabbar)
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
class Q_WIDGETS_EXPORT QStyleOptionToolBar : public QStyleOption
{
@@ -321,7 +321,7 @@ protected:
Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionToolBar::ToolBarFeatures)
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
class Q_WIDGETS_EXPORT QStyleOptionProgressBar : public QStyleOption
{
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index cdeb6a5768..94509f621e 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -111,7 +111,9 @@
#include "qdrawutil.h"
#include <limits.h>
+#if QT_CONFIG(toolbar)
#include <QtWidgets/qtoolbar.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -1979,7 +1981,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption
if (frm->features & QStyleOptionFrame::Flat)
extraClass |= PseudoClass_Flat;
}
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
else if (const QStyleOptionToolBar *tb = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
if (tb->toolBarArea == Qt::LeftToolBarArea)
extraClass |= PseudoClass_Left;
@@ -1999,7 +2001,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption
else if (tb->positionWithinLine == QStyleOptionToolBar::OnlyOne)
extraClass |= PseudoClass_OnlyOne;
}
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
#if QT_CONFIG(toolbox)
else if (const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) {
if (tb->position == QStyleOptionToolBox::OnlyOneTab)
@@ -3594,13 +3596,13 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
if (rule.hasBorder()) {
rule.drawBorder(p, rule.borderRect(opt->rect));
} else {
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (const QStyleOptionToolBar *tb = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
QStyleOptionToolBar newTb(*tb);
newTb.rect = rule.borderRect(opt->rect);
baseStyle()->drawControl(ce, &newTb, p, w);
}
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
}
return;
@@ -5923,12 +5925,12 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c
return positionRect(w, subRule, subRule2, pe, opt->rect, opt->direction);
}
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
case SE_ToolBarHandle:
if (hasStyleRule(w, PseudoElement_ToolBarHandle))
return ParentStyle::subElementRect(se, opt, w);
break;
-#endif //QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
// On mac we make pixel adjustments to layouts which are not
// desireable when you have custom style sheets on them
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index 89011350ec..7c9d917784 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -661,7 +661,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
bool doRestore = false;
switch (pe) {
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
case PE_IndicatorToolBarSeparator:
{
QRect rect = opt->rect;
@@ -721,7 +721,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
p->restore();
break;
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
case PE_FrameButtonTool:
case PE_PanelButtonTool: {
QPen oldPen = p->pen();
@@ -1572,7 +1572,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
p->fillRect(opt->rect, fill);
}
break; }
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
case CE_ToolBar:
if (const QStyleOptionToolBar *toolbar = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
// Reserve the beveled appearance only for mainwindow toolbars
@@ -1673,7 +1673,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
break;
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
case CE_ProgressBarContents:
if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index 71726eaeee..75289e9d1f 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -53,6 +53,7 @@
#include "qmainwindow.h"
#include "qwidgetanimator_p.h"
#include "qmainwindowlayout_p.h"
+#include "qmenu_p.h"
#include "qdockwidget_p.h"
#include <private/qlayoutengine_p.h>
diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp
index bf0a88e7fb..2014bdabf3 100644
--- a/src/widgets/widgets/qmainwindow.cpp
+++ b/src/widgets/widgets/qmainwindow.cpp
@@ -45,7 +45,9 @@
#if QT_CONFIG(dockwidget)
#include "qdockwidget.h"
#endif
+#if QT_CONFIG(toolbar)
#include "qtoolbar.h"
+#endif
#include <qapplication.h>
#include <qmenu.h>
@@ -61,7 +63,9 @@
#include <qpainter.h>
#include <private/qwidget_p.h>
+#if QT_CONFIG(toolbar)
#include "qtoolbar_p.h"
+#endif
#include "qwidgetanimator_p.h"
#ifdef Q_OS_OSX
#include <qpa/qplatformnativeinterface.h>
@@ -706,7 +710,7 @@ Qt::DockWidgetArea QMainWindow::corner(Qt::Corner corner) const
{ return d_func()->layout->corner(corner); }
#endif
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
static bool checkToolBarArea(Qt::ToolBarArea area, const char *where)
{
@@ -874,7 +878,7 @@ bool QMainWindow::toolBarBreak(QToolBar *toolbar) const
return d_func()->layout->toolBarBreak(toolbar);
}
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
#if QT_CONFIG(dockwidget)
@@ -1312,7 +1316,7 @@ bool QMainWindow::event(QEvent *event)
return true;
switch (event->type()) {
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
case QEvent::ToolBarChange: {
d->layout->toggleToolBarsVisible();
return true;
@@ -1344,7 +1348,7 @@ bool QMainWindow::event(QEvent *event)
return QWidget::event(event);
}
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
/*!
\property QMainWindow::unifiedTitleAndToolBarOnMac
@@ -1389,7 +1393,7 @@ bool QMainWindow::unifiedTitleAndToolBarOnMac() const
return false;
}
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
/*!
\internal
@@ -1435,7 +1439,7 @@ void QMainWindow::contextMenuEvent(QContextMenuEvent *event)
break;
}
#endif // QT_CONFIG(dockwidget)
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (QToolBar *tb = qobject_cast<QToolBar *>(child)) {
if (tb->parentWidget() != this)
return;
@@ -1506,7 +1510,7 @@ QMenu *QMainWindow::createPopupMenu()
menu->addSeparator();
}
#endif // QT_CONFIG(dockwidget)
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
QList<QToolBar *> toolbars = findChildren<QToolBar *>();
if (toolbars.size()) {
if (!menu)
diff --git a/src/widgets/widgets/qmainwindow.h b/src/widgets/widgets/qmainwindow.h
index 069683d4ac..8f2a192446 100644
--- a/src/widgets/widgets/qmainwindow.h
+++ b/src/widgets/widgets/qmainwindow.h
@@ -74,7 +74,7 @@ class Q_WIDGETS_EXPORT QMainWindow : public QWidget
Q_PROPERTY(bool dockNestingEnabled READ isDockNestingEnabled WRITE setDockNestingEnabled)
#endif // QT_CONFIG(dockwidget)
Q_PROPERTY(DockOptions dockOptions READ dockOptions WRITE setDockOptions)
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
Q_PROPERTY(bool unifiedTitleAndToolBarOnMac READ unifiedTitleAndToolBarOnMac WRITE setUnifiedTitleAndToolBarOnMac)
#endif
@@ -145,7 +145,7 @@ public:
Qt::DockWidgetArea corner(Qt::Corner corner) const;
#endif
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
void addToolBarBreak(Qt::ToolBarArea area = Qt::TopToolBarArea);
void insertToolBarBreak(QToolBar *before);
@@ -190,7 +190,7 @@ public Q_SLOTS:
void setAnimated(bool enabled);
void setDockNestingEnabled(bool enabled);
#endif
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
void setUnifiedTitleAndToolBarOnMac(bool set);
#endif
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index d4ce0ffa4c..43c22910f9 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -45,10 +45,12 @@
#include "qdockwidget.h"
#include "qdockwidget_p.h"
#endif
+#if QT_CONFIG(toolbar)
#include "qtoolbar_p.h"
-#include "qmainwindow.h"
#include "qtoolbar.h"
#include "qtoolbarlayout_p.h"
+#endif
+#include "qmainwindow.h"
#include "qwidgetanimator_p.h"
#if QT_CONFIG(rubberband)
#include "qrubberband.h"
@@ -75,6 +77,7 @@
# include <qtextstream.h>
#endif
+#include <private/qmenu_p.h>
#include <private/qapplication_p.h>
#include <private/qlayoutengine_p.h>
#include <private/qwidgetresizehandler_p.h>
@@ -604,7 +607,7 @@ void QDockWidgetGroupWindow::apply()
QMainWindowLayoutState::QMainWindowLayoutState(QMainWindow *win)
:
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
toolBarAreaLayout(win),
#endif
#if QT_CONFIG(dockwidget)
@@ -629,9 +632,9 @@ QSize QMainWindowLayoutState::sizeHint() const
result = centralWidgetItem->sizeHint();
#endif
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
result = toolBarAreaLayout.sizeHint(result);
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
return result;
}
@@ -647,16 +650,16 @@ QSize QMainWindowLayoutState::minimumSize() const
result = centralWidgetItem->minimumSize();
#endif
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
result = toolBarAreaLayout.minimumSize(result);
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
return result;
}
void QMainWindowLayoutState::apply(bool animated)
{
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
toolBarAreaLayout.apply(animated);
#endif
@@ -675,12 +678,12 @@ void QMainWindowLayoutState::apply(bool animated)
void QMainWindowLayoutState::fitLayout()
{
QRect r;
-#ifdef QT_NO_TOOLBAR
+#if !QT_CONFIG(toolbar)
r = rect;
#else
toolBarAreaLayout.rect = rect;
r = toolBarAreaLayout.fitLayout();
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
#if QT_CONFIG(dockwidget)
dockAreaLayout.rect = r;
@@ -692,7 +695,7 @@ void QMainWindowLayoutState::fitLayout()
void QMainWindowLayoutState::deleteAllLayoutItems()
{
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
toolBarAreaLayout.deleteAllLayoutItems();
#endif
@@ -714,7 +717,7 @@ void QMainWindowLayoutState::deleteCentralWidgetItem()
QLayoutItem *QMainWindowLayoutState::itemAt(int index, int *x) const
{
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (QLayoutItem *ret = toolBarAreaLayout.itemAt(x, index))
return ret;
#endif
@@ -732,7 +735,7 @@ QLayoutItem *QMainWindowLayoutState::itemAt(int index, int *x) const
QLayoutItem *QMainWindowLayoutState::takeAt(int index, int *x)
{
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (QLayoutItem *ret = toolBarAreaLayout.takeAt(x, index))
return ret;
#endif
@@ -755,7 +758,7 @@ QList<int> QMainWindowLayoutState::indexOf(QWidget *widget) const
{
QList<int> result;
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
// is it a toolbar?
if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget)) {
result = toolBarAreaLayout.indexOf(toolBar);
@@ -790,7 +793,7 @@ bool QMainWindowLayoutState::contains(QWidget *widget) const
return true;
#endif
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (!toolBarAreaLayout.indexOf(widget).isEmpty())
return true;
#endif
@@ -833,7 +836,7 @@ QList<int> QMainWindowLayoutState::gapIndex(QWidget *widget,
{
QList<int> result;
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
// is it a toolbar?
if (qobject_cast<QToolBar*>(widget) != 0) {
result = toolBarAreaLayout.gapIndex(pos);
@@ -871,7 +874,7 @@ bool QMainWindowLayoutState::insertGap(const QList<int> &path, QLayoutItem *item
int i = path.first();
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (i == 0) {
Q_ASSERT(qobject_cast<QToolBar*>(item->widget()) != 0);
return toolBarAreaLayout.insertGap(path.mid(1), item);
@@ -892,7 +895,7 @@ void QMainWindowLayoutState::remove(const QList<int> &path)
{
int i = path.first();
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (i == 0)
toolBarAreaLayout.remove(path.mid(1));
#endif
@@ -905,7 +908,7 @@ void QMainWindowLayoutState::remove(const QList<int> &path)
void QMainWindowLayoutState::remove(QLayoutItem *item)
{
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
toolBarAreaLayout.remove(item);
#endif
@@ -921,7 +924,7 @@ void QMainWindowLayoutState::remove(QLayoutItem *item)
void QMainWindowLayoutState::clear()
{
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
toolBarAreaLayout.clear();
#endif
@@ -943,7 +946,7 @@ QLayoutItem *QMainWindowLayoutState::item(const QList<int> &path)
{
int i = path.first();
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (i == 0) {
const QToolBarAreaLayoutItem *tbItem = toolBarAreaLayout.item(path.mid(1));
Q_ASSERT(tbItem);
@@ -963,7 +966,7 @@ QRect QMainWindowLayoutState::itemRect(const QList<int> &path) const
{
int i = path.first();
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (i == 0)
return toolBarAreaLayout.itemRect(path.mid(1));
#endif
@@ -980,7 +983,7 @@ QRect QMainWindowLayoutState::gapRect(const QList<int> &path) const
{
int i = path.first();
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (i == 0)
return toolBarAreaLayout.itemRect(path.mid(1));
#endif
@@ -997,7 +1000,7 @@ QLayoutItem *QMainWindowLayoutState::plug(const QList<int> &path)
{
int i = path.first();
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (i == 0)
return toolBarAreaLayout.plug(path.mid(1));
#endif
@@ -1014,7 +1017,7 @@ QLayoutItem *QMainWindowLayoutState::unplug(const QList<int> &path, QMainWindowL
{
int i = path.first();
-#ifdef QT_NO_TOOLBAR
+#if !QT_CONFIG(toolbar)
Q_UNUSED(other);
#else
if (i == 0)
@@ -1045,7 +1048,7 @@ void QMainWindowLayoutState::saveState(QDataStream &stream) const
}
#endif
#endif
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
toolBarAreaLayout.saveState(stream);
#endif
}
@@ -1092,7 +1095,7 @@ bool QMainWindowLayoutState::checkFormat(QDataStream &stream)
stream >> marker;
switch(marker)
{
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
case QToolBarAreaLayout::ToolBarStateMarker:
case QToolBarAreaLayout::ToolBarStateMarkerEx:
{
@@ -1102,7 +1105,7 @@ bool QMainWindowLayoutState::checkFormat(QDataStream &stream)
}
}
break;
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
#if QT_CONFIG(dockwidget)
case QDockAreaLayout::DockWidgetStateMarker:
@@ -1211,7 +1214,7 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream,
#endif // QT_CONFIG(tabwidget)
#endif // QT_CONFIG(dockwidget)
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
case QToolBarAreaLayout::ToolBarStateMarker:
case QToolBarAreaLayout::ToolBarStateMarkerEx:
{
@@ -1232,7 +1235,7 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream,
}
}
break;
-#endif //QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
default:
return false;
}// switch
@@ -1246,7 +1249,7 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream,
** QMainWindowLayoutState - toolbars
*/
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
static inline void validateToolBarArea(Qt::ToolBarArea &area)
{
@@ -1421,7 +1424,7 @@ void QMainWindowLayout::toggleToolBarsVisible()
}
}
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
/******************************************************************************
** QMainWindowLayoutState - dock areas
@@ -1904,7 +1907,7 @@ QLayoutItem *QMainWindowLayout::takeAt(int index)
layoutState.remove(ret);
}
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (!currentGapPos.isEmpty() && currentGapPos.constFirst() == 0) {
currentGapPos = layoutState.toolBarAreaLayout.currentGapIndex();
if (!currentGapPos.isEmpty()) {
@@ -2016,7 +2019,7 @@ void QMainWindowLayout::setCurrentHoveredFloat(QDockWidgetGroupWindow *w)
static void fixToolBarOrientation(QLayoutItem *item, int dockPos)
{
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
QToolBar *toolBar = qobject_cast<QToolBar*>(item->widget());
if (toolBar == 0)
return;
@@ -2143,7 +2146,7 @@ void QMainWindowLayout::animationFinished(QWidget *widget)
{
//this function is called from within the Widget Animator whenever an animation is finished
//on a certain widget
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (QToolBar *tb = qobject_cast<QToolBar*>(widget)) {
QToolBarLayout *tbl = qobject_cast<QToolBarLayout*>(tb->layout());
if (tbl->animating) {
@@ -2214,7 +2217,7 @@ void QMainWindowLayout::animationFinished(QWidget *widget)
dw->d_func()->plug(currentGapRect);
}
#endif
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (QToolBar *tb = qobject_cast<QToolBar*>(widget))
tb->d_func()->plug(currentGapRect);
#endif
@@ -2460,7 +2463,7 @@ QLayoutItem *QMainWindowLayout::unplug(QWidget *widget, bool group)
}
}
#endif // QT_CONFIG(dockwidget)
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (QToolBar *tb = qobject_cast<QToolBar*>(widget)) {
tb->d_func()->unplug(r);
}
@@ -2606,7 +2609,7 @@ void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos)
if (qobject_cast<QDockWidgetGroupWindow *>(widget))
allowed = true;
#endif
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (QToolBar *tb = qobject_cast<QToolBar*>(widget))
allowed = tb->isAreaAllowed(toToolBarArea(path.at(1)));
#endif
diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h
index 53e045aaae..aa446cf05b 100644
--- a/src/widgets/widgets/qmainwindowlayout_p.h
+++ b/src/widgets/widgets/qmainwindowlayout_p.h
@@ -69,7 +69,9 @@
#if QT_CONFIG(dockwidget)
#include "qdockarealayout_p.h"
#endif
+#if QT_CONFIG(toolbar)
#include "qtoolbararealayout_p.h"
+#endif
QT_REQUIRE_CONFIG(mainwindow);
@@ -385,7 +387,7 @@ public:
QMainWindowLayoutState(QMainWindow *win);
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
QToolBarAreaLayout toolBarAreaLayout;
#endif
@@ -462,7 +464,7 @@ public:
// toolbars
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
void addToolBarBreak(Qt::ToolBarArea area);
void insertToolBarBreak(QToolBar *before);
void removeToolBarBreak(QToolBar *before);
diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h
index b6afb05e3a..721a35bf90 100644
--- a/src/widgets/widgets/qmenu_p.h
+++ b/src/widgets/widgets/qmenu_p.h
@@ -68,6 +68,33 @@ QT_REQUIRE_CONFIG(menu);
QT_BEGIN_NAMESPACE
+static inline int pick(Qt::Orientation o, const QPoint &pos)
+{ return o == Qt::Horizontal ? pos.x() : pos.y(); }
+
+static inline int pick(Qt::Orientation o, const QSize &size)
+{ return o == Qt::Horizontal ? size.width() : size.height(); }
+
+static inline int &rpick(Qt::Orientation o, QPoint &pos)
+{ return o == Qt::Horizontal ? pos.rx() : pos.ry(); }
+
+static inline int &rpick(Qt::Orientation o, QSize &size)
+{ return o == Qt::Horizontal ? size.rwidth() : size.rheight(); }
+
+static inline QSizePolicy::Policy pick(Qt::Orientation o, const QSizePolicy &policy)
+{ return o == Qt::Horizontal ? policy.horizontalPolicy() : policy.verticalPolicy(); }
+
+static inline int perp(Qt::Orientation o, const QPoint &pos)
+{ return o == Qt::Vertical ? pos.x() : pos.y(); }
+
+static inline int perp(Qt::Orientation o, const QSize &size)
+{ return o == Qt::Vertical ? size.width() : size.height(); }
+
+static inline int &rperp(Qt::Orientation o, QPoint &pos)
+{ return o == Qt::Vertical ? pos.rx() : pos.ry(); }
+
+static inline int &rperp(Qt::Orientation o, QSize &size)
+{ return o == Qt::Vertical ? size.rwidth() : size.rheight(); }
+
class QTornOffMenu;
class QEventLoop;
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index b0a75288e8..4758f64c8c 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -52,7 +52,9 @@
#if QT_CONFIG(mainwindow)
#include <qmainwindow.h>
#endif
+#if QT_CONFIG(toolbar)
#include <qtoolbar.h>
+#endif
#if QT_CONFIG(toolbutton)
#include <qtoolbutton.h>
#endif
diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp
index afb17f533b..8f7271c2dc 100644
--- a/src/widgets/widgets/qpushbutton.cpp
+++ b/src/widgets/widgets/qpushbutton.cpp
@@ -53,7 +53,9 @@
#include "qpushbutton.h"
#include "qstyle.h"
#include "qstyleoption.h"
+#if QT_CONFIG(toolbar)
#include "qtoolbar.h"
+#endif
#include "qdebug.h"
#include "qlayoutitem.h"
#if QT_CONFIG(dialogbuttonbox)
@@ -596,7 +598,7 @@ QPoint QPushButtonPrivate::adjustedMenuPosition()
Q_Q(QPushButton);
bool horizontal = true;
-#if !defined(QT_NO_TOOLBAR)
+#if QT_CONFIG(toolbar)
QToolBar *tb = qobject_cast<QToolBar*>(parent);
if (tb && tb->orientation() == Qt::Vertical)
horizontal = false;
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index 7b6a2a329f..4e90bce69d 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -39,8 +39,6 @@
#include "qtoolbar.h"
-#ifndef QT_NO_TOOLBAR
-
#include <qapplication.h>
#if QT_CONFIG(combobox)
#include <qcombobox.h>
@@ -1288,5 +1286,3 @@ void QToolBar::initStyleOption(QStyleOptionToolBar *option) const
QT_END_NAMESPACE
#include "moc_qtoolbar.cpp"
-
-#endif // QT_NO_TOOLBAR
diff --git a/src/widgets/widgets/qtoolbar.h b/src/widgets/widgets/qtoolbar.h
index 0253541a2e..4ae83190d1 100644
--- a/src/widgets/widgets/qtoolbar.h
+++ b/src/widgets/widgets/qtoolbar.h
@@ -44,10 +44,9 @@
#include <QtWidgets/qaction.h>
#include <QtWidgets/qwidget.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(toolbar);
-#ifndef QT_NO_TOOLBAR
+QT_BEGIN_NAMESPACE
class QToolBarPrivate;
@@ -211,8 +210,6 @@ private:
inline QAction *QToolBar::actionAt(int ax, int ay) const
{ return actionAt(QPoint(ax, ay)); }
-#endif // QT_NO_TOOLBAR
-
QT_END_NAMESPACE
#endif // QDYNAMICTOOLBAR_H
diff --git a/src/widgets/widgets/qtoolbar_p.h b/src/widgets/widgets/qtoolbar_p.h
index 616f53f717..4db75762c8 100644
--- a/src/widgets/widgets/qtoolbar_p.h
+++ b/src/widgets/widgets/qtoolbar_p.h
@@ -57,9 +57,9 @@
#include "private/qwidget_p.h"
#include <QtCore/qbasictimer.h>
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(toolbar);
-#ifndef QT_NO_TOOLBAR
+QT_BEGIN_NAMESPACE
class QToolBarLayout;
class QTimer;
@@ -127,8 +127,6 @@ public:
QBasicTimer waitForPopupTimer;
};
-#endif // QT_NO_TOOLBAR
-
QT_END_NAMESPACE
#endif // QDYNAMICTOOLBAR_P_H
diff --git a/src/widgets/widgets/qtoolbararealayout.cpp b/src/widgets/widgets/qtoolbararealayout.cpp
index 0c57d9251d..edf497111b 100644
--- a/src/widgets/widgets/qtoolbararealayout.cpp
+++ b/src/widgets/widgets/qtoolbararealayout.cpp
@@ -53,8 +53,6 @@
** QToolBarAreaLayoutItem
*/
-#ifndef QT_NO_TOOLBAR
-
QT_BEGIN_NAMESPACE
// qmainwindow.cpp
@@ -1391,5 +1389,3 @@ bool QToolBarAreaLayout::isEmpty() const
}
QT_END_NAMESPACE
-
-#endif // QT_NO_TOOLBAR
diff --git a/src/widgets/widgets/qtoolbararealayout_p.h b/src/widgets/widgets/qtoolbararealayout_p.h
index 901f04cf14..dffbab1f21 100644
--- a/src/widgets/widgets/qtoolbararealayout_p.h
+++ b/src/widgets/widgets/qtoolbararealayout_p.h
@@ -52,40 +52,14 @@
//
#include <QtWidgets/private/qtwidgetsglobal_p.h>
+#include "qmenu_p.h"
#include <QList>
#include <QSize>
#include <QRect>
-QT_BEGIN_NAMESPACE
-
-static inline int pick(Qt::Orientation o, const QPoint &pos)
-{ return o == Qt::Horizontal ? pos.x() : pos.y(); }
-
-static inline int pick(Qt::Orientation o, const QSize &size)
-{ return o == Qt::Horizontal ? size.width() : size.height(); }
-
-static inline int &rpick(Qt::Orientation o, QPoint &pos)
-{ return o == Qt::Horizontal ? pos.rx() : pos.ry(); }
-
-static inline int &rpick(Qt::Orientation o, QSize &size)
-{ return o == Qt::Horizontal ? size.rwidth() : size.rheight(); }
-
-static inline QSizePolicy::Policy pick(Qt::Orientation o, const QSizePolicy &policy)
-{ return o == Qt::Horizontal ? policy.horizontalPolicy() : policy.verticalPolicy(); }
-
-static inline int perp(Qt::Orientation o, const QPoint &pos)
-{ return o == Qt::Vertical ? pos.x() : pos.y(); }
+QT_REQUIRE_CONFIG(toolbar);
-static inline int perp(Qt::Orientation o, const QSize &size)
-{ return o == Qt::Vertical ? size.width() : size.height(); }
-
-static inline int &rperp(Qt::Orientation o, QPoint &pos)
-{ return o == Qt::Vertical ? pos.rx() : pos.ry(); }
-
-static inline int &rperp(Qt::Orientation o, QSize &size)
-{ return o == Qt::Vertical ? size.rwidth() : size.rheight(); }
-
-#ifndef QT_NO_TOOLBAR
+QT_BEGIN_NAMESPACE
class QToolBar;
class QLayoutItem;
@@ -244,7 +218,6 @@ public:
bool isEmpty() const;
};
-
QT_END_NAMESPACE
-#endif // QT_NO_TOOLBAR
+
#endif // QTOOLBARAREALAYOUT_P_H
diff --git a/src/widgets/widgets/qtoolbarlayout.cpp b/src/widgets/widgets/qtoolbarlayout.cpp
index 118cb2ae61..f2d329d59d 100644
--- a/src/widgets/widgets/qtoolbarlayout.cpp
+++ b/src/widgets/widgets/qtoolbarlayout.cpp
@@ -59,8 +59,6 @@
#include "qtoolbarlayout_p.h"
#include "qtoolbarseparator_p.h"
-#ifndef QT_NO_TOOLBAR
-
QT_BEGIN_NAMESPACE
// qmainwindow.cpp
@@ -753,5 +751,3 @@ QToolBarItem *QToolBarLayout::createItem(QAction *action)
QT_END_NAMESPACE
#include "moc_qtoolbarlayout_p.cpp"
-
-#endif // QT_NO_TOOLBAR
diff --git a/src/widgets/widgets/qtoolbarlayout_p.h b/src/widgets/widgets/qtoolbarlayout_p.h
index 8c60164439..b813cd5e2c 100644
--- a/src/widgets/widgets/qtoolbarlayout_p.h
+++ b/src/widgets/widgets/qtoolbarlayout_p.h
@@ -56,9 +56,9 @@
#include <private/qlayoutengine_p.h>
#include <QVector>
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(toolbar);
-#ifndef QT_NO_TOOLBAR
+QT_BEGIN_NAMESPACE
class QAction;
class QToolBarExtension;
@@ -127,8 +127,6 @@ private:
QMenu *popupMenu;
};
-#endif // QT_NO_TOOLBAR
-
QT_END_NAMESPACE
#endif // QTOOLBARLAYOUT_P_H
diff --git a/src/widgets/widgets/qtoolbarseparator.cpp b/src/widgets/widgets/qtoolbarseparator.cpp
index c99a8bcc4c..92cd08317a 100644
--- a/src/widgets/widgets/qtoolbarseparator.cpp
+++ b/src/widgets/widgets/qtoolbarseparator.cpp
@@ -39,8 +39,6 @@
#include "qtoolbarseparator_p.h"
-#ifndef QT_NO_TOOLBAR
-
#include <qstyle.h>
#include <qstyleoption.h>
#include <qtoolbar.h>
@@ -87,5 +85,3 @@ void QToolBarSeparator::paintEvent(QPaintEvent *)
QT_END_NAMESPACE
#include "moc_qtoolbarseparator_p.cpp"
-
-#endif // QT_NO_TOOLBAR
diff --git a/src/widgets/widgets/qtoolbarseparator_p.h b/src/widgets/widgets/qtoolbarseparator_p.h
index d52b4fa6ae..60b51a28cb 100644
--- a/src/widgets/widgets/qtoolbarseparator_p.h
+++ b/src/widgets/widgets/qtoolbarseparator_p.h
@@ -54,9 +54,9 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtWidgets/qwidget.h"
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(toolbar);
-#ifndef QT_NO_TOOLBAR
+QT_BEGIN_NAMESPACE
class QStyleOption;
class QToolBar;
@@ -80,8 +80,6 @@ public Q_SLOTS:
void setOrientation(Qt::Orientation orientation);
};
-#endif // QT_NO_TOOLBAR
-
QT_END_NAMESPACE
#endif // QDYNAMICTOOLBARSEPARATOR_P_H
diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp
index c2bf13a3e9..c94c10574f 100644
--- a/src/widgets/widgets/qtoolbutton.cpp
+++ b/src/widgets/widgets/qtoolbutton.cpp
@@ -53,7 +53,9 @@
#if QT_CONFIG(mainwindow)
#include <qmainwindow.h>
#endif
+#if QT_CONFIG(toolbar)
#include <qtoolbar.h>
+#endif
#include <qvariant.h>
#include <qstylepainter.h>
#include <private/qabstractbutton_p.h>
@@ -201,7 +203,7 @@ void QToolButtonPrivate::init()
{
Q_Q(QToolButton);
defaultAction = 0;
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (qobject_cast<QToolBar*>(parent))
autoRaise = true;
else
@@ -245,13 +247,13 @@ void QToolButton::initStyleOption(QStyleOptionToolButton *option) const
bool forceNoText = false;
option->iconSize = iconSize(); //default value
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
if (parentWidget()) {
if (QToolBar *toolBar = qobject_cast<QToolBar *>(parentWidget())) {
option->iconSize = toolBar->iconSize();
}
}
-#endif // QT_NO_TOOLBAR
+#endif // QT_CONFIG(toolbar)
if (!forceNoText)
option->text = d->text;
@@ -571,7 +573,7 @@ void QToolButton::timerEvent(QTimerEvent *e)
*/
void QToolButton::changeEvent(QEvent *e)
{
-#ifndef QT_NO_TOOLBAR
+#if QT_CONFIG(toolbar)
Q_D(QToolButton);
if (e->type() == QEvent::ParentChange) {
if (qobject_cast<QToolBar*>(parentWidget()))
@@ -743,7 +745,7 @@ void QToolButtonPrivate::popupTimerDone()
repeat = q->autoRepeat();
q->setAutoRepeat(false);
bool horizontal = true;
-#if !defined(QT_NO_TOOLBAR)
+#if QT_CONFIG(toolbar)
QToolBar *tb = qobject_cast<QToolBar*>(parent);
if (tb && tb->orientation() == Qt::Vertical)
horizontal = false;
diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri
index a197c41b95..55804c5aaf 100644
--- a/src/widgets/widgets/widgets.pri
+++ b/src/widgets/widgets/widgets.pri
@@ -3,25 +3,16 @@
HEADERS += \
widgets/qframe.h \
widgets/qframe_p.h \
- widgets/qtoolbar.h \
- widgets/qtoolbar_p.h \
- widgets/qtoolbarlayout_p.h \
- widgets/qtoolbarseparator_p.h \
widgets/qabstractscrollarea.h \
widgets/qabstractscrollarea_p.h \
widgets/qfocusframe.h \
- widgets/qwidgetanimator_p.h \
- widgets/qtoolbararealayout_p.h
+ widgets/qwidgetanimator_p.h
SOURCES += \
widgets/qframe.cpp \
- widgets/qtoolbar.cpp \
- widgets/qtoolbarlayout.cpp \
- widgets/qtoolbarseparator.cpp \
widgets/qabstractscrollarea.cpp \
widgets/qfocusframe.cpp \
- widgets/qwidgetanimator.cpp \
- widgets/qtoolbararealayout.cpp
+ widgets/qwidgetanimator.cpp
qtConfig(abstractbutton) {
HEADERS += \
@@ -326,6 +317,21 @@ qtConfig(tabwidget) {
SOURCES += widgets/qtabwidget.cpp
}
+qtConfig(toolbar) {
+ HEADERS += \
+ widgets/qtoolbar.h \
+ widgets/qtoolbar_p.h \
+ widgets/qtoolbararealayout_p.h \
+ widgets/qtoolbarlayout_p.h \
+ widgets/qtoolbarseparator_p.h
+
+ SOURCES += \
+ widgets/qtoolbar.cpp \
+ widgets/qtoolbarlayout.cpp \
+ widgets/qtoolbararealayout.cpp \
+ widgets/qtoolbarseparator.cpp
+}
+
qtConfig(toolbox) {
HEADERS += widgets/qtoolbox.h
SOURCES += widgets/qtoolbox.cpp