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>
This commit is contained in:
Stephan Binner 2017-08-27 19:07:31 +02:00 committed by Paul Olav Tvete
parent 3761d99512
commit 364bd6ca74
30 changed files with 168 additions and 157 deletions

View File

@ -110,7 +110,9 @@
#include <qstyleoption.h> #include <qstyleoption.h>
#include <qtextedit.h> #include <qtextedit.h>
#include <qtextstream.h> #include <qtextstream.h>
#if QT_CONFIG(toolbar)
#include <qtoolbar.h> #include <qtoolbar.h>
#endif
#if QT_CONFIG(toolbutton) #if QT_CONFIG(toolbutton)
#include <qtoolbutton.h> #include <qtoolbutton.h>
#endif #endif

View File

@ -75,7 +75,9 @@
#if QT_CONFIG(spinbox) #if QT_CONFIG(spinbox)
#include <qspinbox.h> #include <qspinbox.h>
#endif #endif
#if QT_CONFIG(toolbar)
#include <qtoolbar.h> #include <qtoolbar.h>
#endif
#if QT_CONFIG(combobox) #if QT_CONFIG(combobox)
#include <qcombobox.h> #include <qcombobox.h>
#endif #endif

View File

@ -79,7 +79,9 @@
#if QT_CONFIG(pushbutton) #if QT_CONFIG(pushbutton)
#include <qpushbutton.h> #include <qpushbutton.h>
#endif #endif
#if QT_CONFIG(toolbar)
#include <qtoolbar.h> #include <qtoolbar.h>
#endif
#include <qlabel.h> #include <qlabel.h>
#include <qvarlengtharray.h> #include <qvarlengtharray.h>
#include <qdebug.h> #include <qdebug.h>
@ -3311,12 +3313,12 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con
res = 160; res = 160;
break; break;
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
case PM_ToolBarHandleExtent: case PM_ToolBarHandleExtent:
res = int(QStyleHelper::dpiScaled(8.)); res = int(QStyleHelper::dpiScaled(8.));
break; break;
#endif // QT_NO_TOOLBAR #endif // QT_CONFIG(toolbar)
case PM_DockWidgetSeparatorExtent: case PM_DockWidgetSeparatorExtent:
case PM_DockWidgetTitleMargin: case PM_DockWidgetTitleMargin:
res = int(QStyleHelper::dpiScaled(4.)); res = int(QStyleHelper::dpiScaled(4.));

View File

@ -44,7 +44,9 @@
#if QT_CONFIG(menubar) #if QT_CONFIG(menubar)
#include "qmenubar.h" #include "qmenubar.h"
#endif #endif
#if QT_CONFIG(toolbar)
#include "qtoolbar.h" #include "qtoolbar.h"
#endif
#if QT_CONFIG(sizegrip) #if QT_CONFIG(sizegrip)
#include "qsizegrip.h" #include "qsizegrip.h"
#endif #endif

View File

@ -44,7 +44,9 @@
#if QT_CONFIG(menubar) #if QT_CONFIG(menubar)
#include "qmenubar.h" #include "qmenubar.h"
#endif #endif
#if QT_CONFIG(toolbar)
#include "qtoolbar.h" #include "qtoolbar.h"
#endif
#include "qevent.h" #include "qevent.h"
#include "qstyle.h" #include "qstyle.h"
#include "qvariant.h" #include "qvariant.h"

View File

@ -251,10 +251,10 @@ static QEvent *cloneEvent(QEvent *e)
return new QWhatsThisClickedEvent(*static_cast<QWhatsThisClickedEvent*>(e)); return new QWhatsThisClickedEvent(*static_cast<QWhatsThisClickedEvent*>(e));
#endif // QT_CONFIG(whatsthis) #endif // QT_CONFIG(whatsthis)
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
case QEvent::ToolBarChange: case QEvent::ToolBarChange:
return new QToolBarChangeEvent(*static_cast<QToolBarChangeEvent*>(e)); return new QToolBarChangeEvent(*static_cast<QToolBarChangeEvent*>(e));
#endif //QT_NO_TOOLBAR #endif // QT_CONFIG(toolbar)
case QEvent::ApplicationActivate: case QEvent::ApplicationActivate:
return new QEvent(*e); return new QEvent(*e);

View File

@ -81,7 +81,9 @@
#if QT_CONFIG(tabwidget) #if QT_CONFIG(tabwidget)
#include <qtabwidget.h> #include <qtabwidget.h>
#endif #endif
#if QT_CONFIG(toolbar)
#include <qtoolbar.h> #include <qtoolbar.h>
#endif
#if QT_CONFIG(toolbutton) #if QT_CONFIG(toolbutton)
#include <qtoolbutton.h> #include <qtoolbutton.h>
#endif #endif
@ -276,7 +278,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
} }
} }
break; break;
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
case PE_PanelMenuBar: case PE_PanelMenuBar:
if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) if (widget && qobject_cast<QToolBar *>(widget->parentWidget()))
break; break;
@ -295,7 +297,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
break; break;
case PE_PanelToolBar: case PE_PanelToolBar:
break; break;
#endif // QT_NO_TOOLBAR #endif // QT_CONFIG(toolbar)
#if QT_CONFIG(progressbar) #if QT_CONFIG(progressbar)
case PE_IndicatorProgressChunk: case PE_IndicatorProgressChunk:
{ {
@ -477,7 +479,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
} }
break; break;
#endif // QT_CONFIG(dockwidget) #endif // QT_CONFIG(dockwidget)
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
case PE_IndicatorToolBarHandle: case PE_IndicatorToolBarHandle:
p->save(); p->save();
p->translate(opt->rect.x(), opt->rect.y()); 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); qDrawShadeLine(p, p1, p2, opt->palette, 1, 1, 0);
break; break;
} }
#endif // QT_NO_TOOLBAR #endif // QT_CONFIG(toolbar)
#if QT_CONFIG(spinbox) #if QT_CONFIG(spinbox)
case PE_IndicatorSpinPlus: case PE_IndicatorSpinPlus:
case PE_IndicatorSpinMinus: { case PE_IndicatorSpinMinus: {
@ -2153,7 +2155,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
} }
break; break;
#endif // QT_CONFIG(combobox) #endif // QT_CONFIG(combobox)
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
case CE_ToolBar: case CE_ToolBar:
if (const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) { if (const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
// Compatibility with styles that use PE_PanelToolBar // Compatibility with styles that use PE_PanelToolBar
@ -2169,7 +2171,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
&toolBar->palette.brush(QPalette::Button)); &toolBar->palette.brush(QPalette::Button));
} }
break; break;
#endif // QT_NO_TOOLBAR #endif // QT_CONFIG(toolbar)
case CE_ColumnViewGrip: { case CE_ColumnViewGrip: {
// draw background gradients // draw background gradients
QLinearGradient g(0, 0, opt->rect.width(), 0); QLinearGradient g(0, 0, opt->rect.width(), 0);
@ -3072,7 +3074,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
} }
break; break;
#endif // QT_CONFIG(itemviews) #endif // QT_CONFIG(itemviews)
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
case SE_ToolBarHandle: case SE_ToolBarHandle:
if (const QStyleOptionToolBar *tbopt = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) { if (const QStyleOptionToolBar *tbopt = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
if (tbopt->features & QStyleOptionToolBar::Movable) { if (tbopt->features & QStyleOptionToolBar::Movable) {
@ -3090,7 +3092,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
} }
} }
break; break;
#endif //QT_NO_TOOLBAR #endif // QT_CONFIG(toolbar)
default: default:
break; break;
} }
@ -4570,7 +4572,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
ret = 0; ret = 0;
break; break;
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
case PM_ToolBarFrameWidth: case PM_ToolBarFrameWidth:
ret = 1; ret = 1;
break; break;
@ -4594,7 +4596,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
case PM_ToolBarExtensionExtent: case PM_ToolBarExtensionExtent:
ret = int(QStyleHelper::dpiScaled(12.)); ret = int(QStyleHelper::dpiScaled(12.));
break; break;
#endif // QT_NO_TOOLBAR #endif // QT_CONFIG(toolbar)
#if QT_CONFIG(tabbar) #if QT_CONFIG(tabbar)
case PM_TabBarTabOverlap: case PM_TabBarTabOverlap:

View File

@ -1040,7 +1040,7 @@ QStyleOptionButton::QStyleOptionButton(int version)
*/ */
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
/*! /*!
\class QStyleOptionToolBar \class QStyleOptionToolBar
\brief The QStyleOptionToolBar class is used to describe the \brief The QStyleOptionToolBar class is used to describe the

View File

@ -296,7 +296,7 @@ typedef Q_DECL_DEPRECATED QStyleOptionTab QStyleOptionTabV3;
#endif // QT_CONFIG(tabbar) #endif // QT_CONFIG(tabbar)
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
class Q_WIDGETS_EXPORT QStyleOptionToolBar : public QStyleOption class Q_WIDGETS_EXPORT QStyleOptionToolBar : public QStyleOption
{ {
@ -321,7 +321,7 @@ protected:
Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionToolBar::ToolBarFeatures) Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionToolBar::ToolBarFeatures)
#endif // QT_NO_TOOLBAR #endif // QT_CONFIG(toolbar)
class Q_WIDGETS_EXPORT QStyleOptionProgressBar : public QStyleOption class Q_WIDGETS_EXPORT QStyleOptionProgressBar : public QStyleOption
{ {

View File

@ -111,7 +111,9 @@
#include "qdrawutil.h" #include "qdrawutil.h"
#include <limits.h> #include <limits.h>
#if QT_CONFIG(toolbar)
#include <QtWidgets/qtoolbar.h> #include <QtWidgets/qtoolbar.h>
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -1979,7 +1981,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption
if (frm->features & QStyleOptionFrame::Flat) if (frm->features & QStyleOptionFrame::Flat)
extraClass |= PseudoClass_Flat; extraClass |= PseudoClass_Flat;
} }
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
else if (const QStyleOptionToolBar *tb = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) { else if (const QStyleOptionToolBar *tb = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
if (tb->toolBarArea == Qt::LeftToolBarArea) if (tb->toolBarArea == Qt::LeftToolBarArea)
extraClass |= PseudoClass_Left; extraClass |= PseudoClass_Left;
@ -1999,7 +2001,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption
else if (tb->positionWithinLine == QStyleOptionToolBar::OnlyOne) else if (tb->positionWithinLine == QStyleOptionToolBar::OnlyOne)
extraClass |= PseudoClass_OnlyOne; extraClass |= PseudoClass_OnlyOne;
} }
#endif // QT_NO_TOOLBAR #endif // QT_CONFIG(toolbar)
#if QT_CONFIG(toolbox) #if QT_CONFIG(toolbox)
else if (const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) { else if (const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) {
if (tb->position == QStyleOptionToolBox::OnlyOneTab) if (tb->position == QStyleOptionToolBox::OnlyOneTab)
@ -3594,13 +3596,13 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
if (rule.hasBorder()) { if (rule.hasBorder()) {
rule.drawBorder(p, rule.borderRect(opt->rect)); rule.drawBorder(p, rule.borderRect(opt->rect));
} else { } else {
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
if (const QStyleOptionToolBar *tb = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) { if (const QStyleOptionToolBar *tb = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
QStyleOptionToolBar newTb(*tb); QStyleOptionToolBar newTb(*tb);
newTb.rect = rule.borderRect(opt->rect); newTb.rect = rule.borderRect(opt->rect);
baseStyle()->drawControl(ce, &newTb, p, w); baseStyle()->drawControl(ce, &newTb, p, w);
} }
#endif // QT_NO_TOOLBAR #endif // QT_CONFIG(toolbar)
} }
return; return;
@ -5923,12 +5925,12 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c
return positionRect(w, subRule, subRule2, pe, opt->rect, opt->direction); return positionRect(w, subRule, subRule2, pe, opt->rect, opt->direction);
} }
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
case SE_ToolBarHandle: case SE_ToolBarHandle:
if (hasStyleRule(w, PseudoElement_ToolBarHandle)) if (hasStyleRule(w, PseudoElement_ToolBarHandle))
return ParentStyle::subElementRect(se, opt, w); return ParentStyle::subElementRect(se, opt, w);
break; break;
#endif //QT_NO_TOOLBAR #endif // QT_CONFIG(toolbar)
// On mac we make pixel adjustments to layouts which are not // On mac we make pixel adjustments to layouts which are not
// desireable when you have custom style sheets on them // desireable when you have custom style sheets on them

View File

@ -661,7 +661,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
bool doRestore = false; bool doRestore = false;
switch (pe) { switch (pe) {
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
case PE_IndicatorToolBarSeparator: case PE_IndicatorToolBarSeparator:
{ {
QRect rect = opt->rect; QRect rect = opt->rect;
@ -721,7 +721,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
p->restore(); p->restore();
break; break;
#endif // QT_NO_TOOLBAR #endif // QT_CONFIG(toolbar)
case PE_FrameButtonTool: case PE_FrameButtonTool:
case PE_PanelButtonTool: { case PE_PanelButtonTool: {
QPen oldPen = p->pen(); QPen oldPen = p->pen();
@ -1572,7 +1572,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
p->fillRect(opt->rect, fill); p->fillRect(opt->rect, fill);
} }
break; } break; }
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
case CE_ToolBar: case CE_ToolBar:
if (const QStyleOptionToolBar *toolbar = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) { if (const QStyleOptionToolBar *toolbar = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
// Reserve the beveled appearance only for mainwindow toolbars // Reserve the beveled appearance only for mainwindow toolbars
@ -1673,7 +1673,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
break; break;
#endif // QT_NO_TOOLBAR #endif // QT_CONFIG(toolbar)
case CE_ProgressBarContents: case CE_ProgressBarContents:
if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) { if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {

View File

@ -53,6 +53,7 @@
#include "qmainwindow.h" #include "qmainwindow.h"
#include "qwidgetanimator_p.h" #include "qwidgetanimator_p.h"
#include "qmainwindowlayout_p.h" #include "qmainwindowlayout_p.h"
#include "qmenu_p.h"
#include "qdockwidget_p.h" #include "qdockwidget_p.h"
#include <private/qlayoutengine_p.h> #include <private/qlayoutengine_p.h>

View File

@ -45,7 +45,9 @@
#if QT_CONFIG(dockwidget) #if QT_CONFIG(dockwidget)
#include "qdockwidget.h" #include "qdockwidget.h"
#endif #endif
#if QT_CONFIG(toolbar)
#include "qtoolbar.h" #include "qtoolbar.h"
#endif
#include <qapplication.h> #include <qapplication.h>
#include <qmenu.h> #include <qmenu.h>
@ -61,7 +63,9 @@
#include <qpainter.h> #include <qpainter.h>
#include <private/qwidget_p.h> #include <private/qwidget_p.h>
#if QT_CONFIG(toolbar)
#include "qtoolbar_p.h" #include "qtoolbar_p.h"
#endif
#include "qwidgetanimator_p.h" #include "qwidgetanimator_p.h"
#ifdef Q_OS_OSX #ifdef Q_OS_OSX
#include <qpa/qplatformnativeinterface.h> #include <qpa/qplatformnativeinterface.h>
@ -706,7 +710,7 @@ Qt::DockWidgetArea QMainWindow::corner(Qt::Corner corner) const
{ return d_func()->layout->corner(corner); } { return d_func()->layout->corner(corner); }
#endif #endif
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
static bool checkToolBarArea(Qt::ToolBarArea area, const char *where) 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); return d_func()->layout->toolBarBreak(toolbar);
} }
#endif // QT_NO_TOOLBAR #endif // QT_CONFIG(toolbar)
#if QT_CONFIG(dockwidget) #if QT_CONFIG(dockwidget)
@ -1312,7 +1316,7 @@ bool QMainWindow::event(QEvent *event)
return true; return true;
switch (event->type()) { switch (event->type()) {
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
case QEvent::ToolBarChange: { case QEvent::ToolBarChange: {
d->layout->toggleToolBarsVisible(); d->layout->toggleToolBarsVisible();
return true; return true;
@ -1344,7 +1348,7 @@ bool QMainWindow::event(QEvent *event)
return QWidget::event(event); return QWidget::event(event);
} }
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
/*! /*!
\property QMainWindow::unifiedTitleAndToolBarOnMac \property QMainWindow::unifiedTitleAndToolBarOnMac
@ -1389,7 +1393,7 @@ bool QMainWindow::unifiedTitleAndToolBarOnMac() const
return false; return false;
} }
#endif // QT_NO_TOOLBAR #endif // QT_CONFIG(toolbar)
/*! /*!
\internal \internal
@ -1435,7 +1439,7 @@ void QMainWindow::contextMenuEvent(QContextMenuEvent *event)
break; break;
} }
#endif // QT_CONFIG(dockwidget) #endif // QT_CONFIG(dockwidget)
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
if (QToolBar *tb = qobject_cast<QToolBar *>(child)) { if (QToolBar *tb = qobject_cast<QToolBar *>(child)) {
if (tb->parentWidget() != this) if (tb->parentWidget() != this)
return; return;
@ -1506,7 +1510,7 @@ QMenu *QMainWindow::createPopupMenu()
menu->addSeparator(); menu->addSeparator();
} }
#endif // QT_CONFIG(dockwidget) #endif // QT_CONFIG(dockwidget)
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
QList<QToolBar *> toolbars = findChildren<QToolBar *>(); QList<QToolBar *> toolbars = findChildren<QToolBar *>();
if (toolbars.size()) { if (toolbars.size()) {
if (!menu) if (!menu)

View File

@ -74,7 +74,7 @@ class Q_WIDGETS_EXPORT QMainWindow : public QWidget
Q_PROPERTY(bool dockNestingEnabled READ isDockNestingEnabled WRITE setDockNestingEnabled) Q_PROPERTY(bool dockNestingEnabled READ isDockNestingEnabled WRITE setDockNestingEnabled)
#endif // QT_CONFIG(dockwidget) #endif // QT_CONFIG(dockwidget)
Q_PROPERTY(DockOptions dockOptions READ dockOptions WRITE setDockOptions) Q_PROPERTY(DockOptions dockOptions READ dockOptions WRITE setDockOptions)
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
Q_PROPERTY(bool unifiedTitleAndToolBarOnMac READ unifiedTitleAndToolBarOnMac WRITE setUnifiedTitleAndToolBarOnMac) Q_PROPERTY(bool unifiedTitleAndToolBarOnMac READ unifiedTitleAndToolBarOnMac WRITE setUnifiedTitleAndToolBarOnMac)
#endif #endif
@ -145,7 +145,7 @@ public:
Qt::DockWidgetArea corner(Qt::Corner corner) const; Qt::DockWidgetArea corner(Qt::Corner corner) const;
#endif #endif
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
void addToolBarBreak(Qt::ToolBarArea area = Qt::TopToolBarArea); void addToolBarBreak(Qt::ToolBarArea area = Qt::TopToolBarArea);
void insertToolBarBreak(QToolBar *before); void insertToolBarBreak(QToolBar *before);
@ -190,7 +190,7 @@ public Q_SLOTS:
void setAnimated(bool enabled); void setAnimated(bool enabled);
void setDockNestingEnabled(bool enabled); void setDockNestingEnabled(bool enabled);
#endif #endif
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
void setUnifiedTitleAndToolBarOnMac(bool set); void setUnifiedTitleAndToolBarOnMac(bool set);
#endif #endif

View File

@ -45,10 +45,12 @@
#include "qdockwidget.h" #include "qdockwidget.h"
#include "qdockwidget_p.h" #include "qdockwidget_p.h"
#endif #endif
#if QT_CONFIG(toolbar)
#include "qtoolbar_p.h" #include "qtoolbar_p.h"
#include "qmainwindow.h"
#include "qtoolbar.h" #include "qtoolbar.h"
#include "qtoolbarlayout_p.h" #include "qtoolbarlayout_p.h"
#endif
#include "qmainwindow.h"
#include "qwidgetanimator_p.h" #include "qwidgetanimator_p.h"
#if QT_CONFIG(rubberband) #if QT_CONFIG(rubberband)
#include "qrubberband.h" #include "qrubberband.h"
@ -75,6 +77,7 @@
# include <qtextstream.h> # include <qtextstream.h>
#endif #endif
#include <private/qmenu_p.h>
#include <private/qapplication_p.h> #include <private/qapplication_p.h>
#include <private/qlayoutengine_p.h> #include <private/qlayoutengine_p.h>
#include <private/qwidgetresizehandler_p.h> #include <private/qwidgetresizehandler_p.h>
@ -604,7 +607,7 @@ void QDockWidgetGroupWindow::apply()
QMainWindowLayoutState::QMainWindowLayoutState(QMainWindow *win) QMainWindowLayoutState::QMainWindowLayoutState(QMainWindow *win)
: :
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
toolBarAreaLayout(win), toolBarAreaLayout(win),
#endif #endif
#if QT_CONFIG(dockwidget) #if QT_CONFIG(dockwidget)
@ -629,9 +632,9 @@ QSize QMainWindowLayoutState::sizeHint() const
result = centralWidgetItem->sizeHint(); result = centralWidgetItem->sizeHint();
#endif #endif
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
result = toolBarAreaLayout.sizeHint(result); result = toolBarAreaLayout.sizeHint(result);
#endif // QT_NO_TOOLBAR #endif // QT_CONFIG(toolbar)
return result; return result;
} }
@ -647,16 +650,16 @@ QSize QMainWindowLayoutState::minimumSize() const
result = centralWidgetItem->minimumSize(); result = centralWidgetItem->minimumSize();
#endif #endif
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
result = toolBarAreaLayout.minimumSize(result); result = toolBarAreaLayout.minimumSize(result);
#endif // QT_NO_TOOLBAR #endif // QT_CONFIG(toolbar)
return result; return result;
} }
void QMainWindowLayoutState::apply(bool animated) void QMainWindowLayoutState::apply(bool animated)
{ {
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
toolBarAreaLayout.apply(animated); toolBarAreaLayout.apply(animated);
#endif #endif
@ -675,12 +678,12 @@ void QMainWindowLayoutState::apply(bool animated)
void QMainWindowLayoutState::fitLayout() void QMainWindowLayoutState::fitLayout()
{ {
QRect r; QRect r;
#ifdef QT_NO_TOOLBAR #if !QT_CONFIG(toolbar)
r = rect; r = rect;
#else #else
toolBarAreaLayout.rect = rect; toolBarAreaLayout.rect = rect;
r = toolBarAreaLayout.fitLayout(); r = toolBarAreaLayout.fitLayout();
#endif // QT_NO_TOOLBAR #endif // QT_CONFIG(toolbar)
#if QT_CONFIG(dockwidget) #if QT_CONFIG(dockwidget)
dockAreaLayout.rect = r; dockAreaLayout.rect = r;
@ -692,7 +695,7 @@ void QMainWindowLayoutState::fitLayout()
void QMainWindowLayoutState::deleteAllLayoutItems() void QMainWindowLayoutState::deleteAllLayoutItems()
{ {
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
toolBarAreaLayout.deleteAllLayoutItems(); toolBarAreaLayout.deleteAllLayoutItems();
#endif #endif
@ -714,7 +717,7 @@ void QMainWindowLayoutState::deleteCentralWidgetItem()
QLayoutItem *QMainWindowLayoutState::itemAt(int index, int *x) const QLayoutItem *QMainWindowLayoutState::itemAt(int index, int *x) const
{ {
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
if (QLayoutItem *ret = toolBarAreaLayout.itemAt(x, index)) if (QLayoutItem *ret = toolBarAreaLayout.itemAt(x, index))
return ret; return ret;
#endif #endif
@ -732,7 +735,7 @@ QLayoutItem *QMainWindowLayoutState::itemAt(int index, int *x) const
QLayoutItem *QMainWindowLayoutState::takeAt(int index, int *x) QLayoutItem *QMainWindowLayoutState::takeAt(int index, int *x)
{ {
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
if (QLayoutItem *ret = toolBarAreaLayout.takeAt(x, index)) if (QLayoutItem *ret = toolBarAreaLayout.takeAt(x, index))
return ret; return ret;
#endif #endif
@ -755,7 +758,7 @@ QList<int> QMainWindowLayoutState::indexOf(QWidget *widget) const
{ {
QList<int> result; QList<int> result;
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
// is it a toolbar? // is it a toolbar?
if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget)) { if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget)) {
result = toolBarAreaLayout.indexOf(toolBar); result = toolBarAreaLayout.indexOf(toolBar);
@ -790,7 +793,7 @@ bool QMainWindowLayoutState::contains(QWidget *widget) const
return true; return true;
#endif #endif
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
if (!toolBarAreaLayout.indexOf(widget).isEmpty()) if (!toolBarAreaLayout.indexOf(widget).isEmpty())
return true; return true;
#endif #endif
@ -833,7 +836,7 @@ QList<int> QMainWindowLayoutState::gapIndex(QWidget *widget,
{ {
QList<int> result; QList<int> result;
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
// is it a toolbar? // is it a toolbar?
if (qobject_cast<QToolBar*>(widget) != 0) { if (qobject_cast<QToolBar*>(widget) != 0) {
result = toolBarAreaLayout.gapIndex(pos); result = toolBarAreaLayout.gapIndex(pos);
@ -871,7 +874,7 @@ bool QMainWindowLayoutState::insertGap(const QList<int> &path, QLayoutItem *item
int i = path.first(); int i = path.first();
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
if (i == 0) { if (i == 0) {
Q_ASSERT(qobject_cast<QToolBar*>(item->widget()) != 0); Q_ASSERT(qobject_cast<QToolBar*>(item->widget()) != 0);
return toolBarAreaLayout.insertGap(path.mid(1), item); return toolBarAreaLayout.insertGap(path.mid(1), item);
@ -892,7 +895,7 @@ void QMainWindowLayoutState::remove(const QList<int> &path)
{ {
int i = path.first(); int i = path.first();
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
if (i == 0) if (i == 0)
toolBarAreaLayout.remove(path.mid(1)); toolBarAreaLayout.remove(path.mid(1));
#endif #endif
@ -905,7 +908,7 @@ void QMainWindowLayoutState::remove(const QList<int> &path)
void QMainWindowLayoutState::remove(QLayoutItem *item) void QMainWindowLayoutState::remove(QLayoutItem *item)
{ {
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
toolBarAreaLayout.remove(item); toolBarAreaLayout.remove(item);
#endif #endif
@ -921,7 +924,7 @@ void QMainWindowLayoutState::remove(QLayoutItem *item)
void QMainWindowLayoutState::clear() void QMainWindowLayoutState::clear()
{ {
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
toolBarAreaLayout.clear(); toolBarAreaLayout.clear();
#endif #endif
@ -943,7 +946,7 @@ QLayoutItem *QMainWindowLayoutState::item(const QList<int> &path)
{ {
int i = path.first(); int i = path.first();
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
if (i == 0) { if (i == 0) {
const QToolBarAreaLayoutItem *tbItem = toolBarAreaLayout.item(path.mid(1)); const QToolBarAreaLayoutItem *tbItem = toolBarAreaLayout.item(path.mid(1));
Q_ASSERT(tbItem); Q_ASSERT(tbItem);
@ -963,7 +966,7 @@ QRect QMainWindowLayoutState::itemRect(const QList<int> &path) const
{ {
int i = path.first(); int i = path.first();
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
if (i == 0) if (i == 0)
return toolBarAreaLayout.itemRect(path.mid(1)); return toolBarAreaLayout.itemRect(path.mid(1));
#endif #endif
@ -980,7 +983,7 @@ QRect QMainWindowLayoutState::gapRect(const QList<int> &path) const
{ {
int i = path.first(); int i = path.first();
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
if (i == 0) if (i == 0)
return toolBarAreaLayout.itemRect(path.mid(1)); return toolBarAreaLayout.itemRect(path.mid(1));
#endif #endif
@ -997,7 +1000,7 @@ QLayoutItem *QMainWindowLayoutState::plug(const QList<int> &path)
{ {
int i = path.first(); int i = path.first();
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
if (i == 0) if (i == 0)
return toolBarAreaLayout.plug(path.mid(1)); return toolBarAreaLayout.plug(path.mid(1));
#endif #endif
@ -1014,7 +1017,7 @@ QLayoutItem *QMainWindowLayoutState::unplug(const QList<int> &path, QMainWindowL
{ {
int i = path.first(); int i = path.first();
#ifdef QT_NO_TOOLBAR #if !QT_CONFIG(toolbar)
Q_UNUSED(other); Q_UNUSED(other);
#else #else
if (i == 0) if (i == 0)
@ -1045,7 +1048,7 @@ void QMainWindowLayoutState::saveState(QDataStream &stream) const
} }
#endif #endif
#endif #endif
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
toolBarAreaLayout.saveState(stream); toolBarAreaLayout.saveState(stream);
#endif #endif
} }
@ -1092,7 +1095,7 @@ bool QMainWindowLayoutState::checkFormat(QDataStream &stream)
stream >> marker; stream >> marker;
switch(marker) switch(marker)
{ {
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
case QToolBarAreaLayout::ToolBarStateMarker: case QToolBarAreaLayout::ToolBarStateMarker:
case QToolBarAreaLayout::ToolBarStateMarkerEx: case QToolBarAreaLayout::ToolBarStateMarkerEx:
{ {
@ -1102,7 +1105,7 @@ bool QMainWindowLayoutState::checkFormat(QDataStream &stream)
} }
} }
break; break;
#endif // QT_NO_TOOLBAR #endif // QT_CONFIG(toolbar)
#if QT_CONFIG(dockwidget) #if QT_CONFIG(dockwidget)
case QDockAreaLayout::DockWidgetStateMarker: case QDockAreaLayout::DockWidgetStateMarker:
@ -1211,7 +1214,7 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream,
#endif // QT_CONFIG(tabwidget) #endif // QT_CONFIG(tabwidget)
#endif // QT_CONFIG(dockwidget) #endif // QT_CONFIG(dockwidget)
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
case QToolBarAreaLayout::ToolBarStateMarker: case QToolBarAreaLayout::ToolBarStateMarker:
case QToolBarAreaLayout::ToolBarStateMarkerEx: case QToolBarAreaLayout::ToolBarStateMarkerEx:
{ {
@ -1232,7 +1235,7 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream,
} }
} }
break; break;
#endif //QT_NO_TOOLBAR #endif // QT_CONFIG(toolbar)
default: default:
return false; return false;
}// switch }// switch
@ -1246,7 +1249,7 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream,
** QMainWindowLayoutState - toolbars ** QMainWindowLayoutState - toolbars
*/ */
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
static inline void validateToolBarArea(Qt::ToolBarArea &area) 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 ** QMainWindowLayoutState - dock areas
@ -1904,7 +1907,7 @@ QLayoutItem *QMainWindowLayout::takeAt(int index)
layoutState.remove(ret); layoutState.remove(ret);
} }
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
if (!currentGapPos.isEmpty() && currentGapPos.constFirst() == 0) { if (!currentGapPos.isEmpty() && currentGapPos.constFirst() == 0) {
currentGapPos = layoutState.toolBarAreaLayout.currentGapIndex(); currentGapPos = layoutState.toolBarAreaLayout.currentGapIndex();
if (!currentGapPos.isEmpty()) { if (!currentGapPos.isEmpty()) {
@ -2016,7 +2019,7 @@ void QMainWindowLayout::setCurrentHoveredFloat(QDockWidgetGroupWindow *w)
static void fixToolBarOrientation(QLayoutItem *item, int dockPos) static void fixToolBarOrientation(QLayoutItem *item, int dockPos)
{ {
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
QToolBar *toolBar = qobject_cast<QToolBar*>(item->widget()); QToolBar *toolBar = qobject_cast<QToolBar*>(item->widget());
if (toolBar == 0) if (toolBar == 0)
return; return;
@ -2143,7 +2146,7 @@ void QMainWindowLayout::animationFinished(QWidget *widget)
{ {
//this function is called from within the Widget Animator whenever an animation is finished //this function is called from within the Widget Animator whenever an animation is finished
//on a certain widget //on a certain widget
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
if (QToolBar *tb = qobject_cast<QToolBar*>(widget)) { if (QToolBar *tb = qobject_cast<QToolBar*>(widget)) {
QToolBarLayout *tbl = qobject_cast<QToolBarLayout*>(tb->layout()); QToolBarLayout *tbl = qobject_cast<QToolBarLayout*>(tb->layout());
if (tbl->animating) { if (tbl->animating) {
@ -2214,7 +2217,7 @@ void QMainWindowLayout::animationFinished(QWidget *widget)
dw->d_func()->plug(currentGapRect); dw->d_func()->plug(currentGapRect);
} }
#endif #endif
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
if (QToolBar *tb = qobject_cast<QToolBar*>(widget)) if (QToolBar *tb = qobject_cast<QToolBar*>(widget))
tb->d_func()->plug(currentGapRect); tb->d_func()->plug(currentGapRect);
#endif #endif
@ -2460,7 +2463,7 @@ QLayoutItem *QMainWindowLayout::unplug(QWidget *widget, bool group)
} }
} }
#endif // QT_CONFIG(dockwidget) #endif // QT_CONFIG(dockwidget)
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
if (QToolBar *tb = qobject_cast<QToolBar*>(widget)) { if (QToolBar *tb = qobject_cast<QToolBar*>(widget)) {
tb->d_func()->unplug(r); tb->d_func()->unplug(r);
} }
@ -2606,7 +2609,7 @@ void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos)
if (qobject_cast<QDockWidgetGroupWindow *>(widget)) if (qobject_cast<QDockWidgetGroupWindow *>(widget))
allowed = true; allowed = true;
#endif #endif
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
if (QToolBar *tb = qobject_cast<QToolBar*>(widget)) if (QToolBar *tb = qobject_cast<QToolBar*>(widget))
allowed = tb->isAreaAllowed(toToolBarArea(path.at(1))); allowed = tb->isAreaAllowed(toToolBarArea(path.at(1)));
#endif #endif

View File

@ -69,7 +69,9 @@
#if QT_CONFIG(dockwidget) #if QT_CONFIG(dockwidget)
#include "qdockarealayout_p.h" #include "qdockarealayout_p.h"
#endif #endif
#if QT_CONFIG(toolbar)
#include "qtoolbararealayout_p.h" #include "qtoolbararealayout_p.h"
#endif
QT_REQUIRE_CONFIG(mainwindow); QT_REQUIRE_CONFIG(mainwindow);
@ -385,7 +387,7 @@ public:
QMainWindowLayoutState(QMainWindow *win); QMainWindowLayoutState(QMainWindow *win);
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
QToolBarAreaLayout toolBarAreaLayout; QToolBarAreaLayout toolBarAreaLayout;
#endif #endif
@ -462,7 +464,7 @@ public:
// toolbars // toolbars
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
void addToolBarBreak(Qt::ToolBarArea area); void addToolBarBreak(Qt::ToolBarArea area);
void insertToolBarBreak(QToolBar *before); void insertToolBarBreak(QToolBar *before);
void removeToolBarBreak(QToolBar *before); void removeToolBarBreak(QToolBar *before);

View File

@ -68,6 +68,33 @@ QT_REQUIRE_CONFIG(menu);
QT_BEGIN_NAMESPACE 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 QTornOffMenu;
class QEventLoop; class QEventLoop;

View File

@ -52,7 +52,9 @@
#if QT_CONFIG(mainwindow) #if QT_CONFIG(mainwindow)
#include <qmainwindow.h> #include <qmainwindow.h>
#endif #endif
#if QT_CONFIG(toolbar)
#include <qtoolbar.h> #include <qtoolbar.h>
#endif
#if QT_CONFIG(toolbutton) #if QT_CONFIG(toolbutton)
#include <qtoolbutton.h> #include <qtoolbutton.h>
#endif #endif

View File

@ -53,7 +53,9 @@
#include "qpushbutton.h" #include "qpushbutton.h"
#include "qstyle.h" #include "qstyle.h"
#include "qstyleoption.h" #include "qstyleoption.h"
#if QT_CONFIG(toolbar)
#include "qtoolbar.h" #include "qtoolbar.h"
#endif
#include "qdebug.h" #include "qdebug.h"
#include "qlayoutitem.h" #include "qlayoutitem.h"
#if QT_CONFIG(dialogbuttonbox) #if QT_CONFIG(dialogbuttonbox)
@ -596,7 +598,7 @@ QPoint QPushButtonPrivate::adjustedMenuPosition()
Q_Q(QPushButton); Q_Q(QPushButton);
bool horizontal = true; bool horizontal = true;
#if !defined(QT_NO_TOOLBAR) #if QT_CONFIG(toolbar)
QToolBar *tb = qobject_cast<QToolBar*>(parent); QToolBar *tb = qobject_cast<QToolBar*>(parent);
if (tb && tb->orientation() == Qt::Vertical) if (tb && tb->orientation() == Qt::Vertical)
horizontal = false; horizontal = false;

View File

@ -39,8 +39,6 @@
#include "qtoolbar.h" #include "qtoolbar.h"
#ifndef QT_NO_TOOLBAR
#include <qapplication.h> #include <qapplication.h>
#if QT_CONFIG(combobox) #if QT_CONFIG(combobox)
#include <qcombobox.h> #include <qcombobox.h>
@ -1288,5 +1286,3 @@ void QToolBar::initStyleOption(QStyleOptionToolBar *option) const
QT_END_NAMESPACE QT_END_NAMESPACE
#include "moc_qtoolbar.cpp" #include "moc_qtoolbar.cpp"
#endif // QT_NO_TOOLBAR

View File

@ -44,11 +44,10 @@
#include <QtWidgets/qaction.h> #include <QtWidgets/qaction.h>
#include <QtWidgets/qwidget.h> #include <QtWidgets/qwidget.h>
QT_REQUIRE_CONFIG(toolbar);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_TOOLBAR
class QToolBarPrivate; class QToolBarPrivate;
class QAction; class QAction;
@ -211,8 +210,6 @@ private:
inline QAction *QToolBar::actionAt(int ax, int ay) const inline QAction *QToolBar::actionAt(int ax, int ay) const
{ return actionAt(QPoint(ax, ay)); } { return actionAt(QPoint(ax, ay)); }
#endif // QT_NO_TOOLBAR
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QDYNAMICTOOLBAR_H #endif // QDYNAMICTOOLBAR_H

View File

@ -57,9 +57,9 @@
#include "private/qwidget_p.h" #include "private/qwidget_p.h"
#include <QtCore/qbasictimer.h> #include <QtCore/qbasictimer.h>
QT_BEGIN_NAMESPACE QT_REQUIRE_CONFIG(toolbar);
#ifndef QT_NO_TOOLBAR QT_BEGIN_NAMESPACE
class QToolBarLayout; class QToolBarLayout;
class QTimer; class QTimer;
@ -127,8 +127,6 @@ public:
QBasicTimer waitForPopupTimer; QBasicTimer waitForPopupTimer;
}; };
#endif // QT_NO_TOOLBAR
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QDYNAMICTOOLBAR_P_H #endif // QDYNAMICTOOLBAR_P_H

View File

@ -53,8 +53,6 @@
** QToolBarAreaLayoutItem ** QToolBarAreaLayoutItem
*/ */
#ifndef QT_NO_TOOLBAR
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
// qmainwindow.cpp // qmainwindow.cpp
@ -1391,5 +1389,3 @@ bool QToolBarAreaLayout::isEmpty() const
} }
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_TOOLBAR

View File

@ -52,41 +52,15 @@
// //
#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qmenu_p.h"
#include <QList> #include <QList>
#include <QSize> #include <QSize>
#include <QRect> #include <QRect>
QT_REQUIRE_CONFIG(toolbar);
QT_BEGIN_NAMESPACE 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(); }
#ifndef QT_NO_TOOLBAR
class QToolBar; class QToolBar;
class QLayoutItem; class QLayoutItem;
class QMainWindow; class QMainWindow;
@ -244,7 +218,6 @@ public:
bool isEmpty() const; bool isEmpty() const;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_TOOLBAR
#endif // QTOOLBARAREALAYOUT_P_H #endif // QTOOLBARAREALAYOUT_P_H

View File

@ -59,8 +59,6 @@
#include "qtoolbarlayout_p.h" #include "qtoolbarlayout_p.h"
#include "qtoolbarseparator_p.h" #include "qtoolbarseparator_p.h"
#ifndef QT_NO_TOOLBAR
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
// qmainwindow.cpp // qmainwindow.cpp
@ -753,5 +751,3 @@ QToolBarItem *QToolBarLayout::createItem(QAction *action)
QT_END_NAMESPACE QT_END_NAMESPACE
#include "moc_qtoolbarlayout_p.cpp" #include "moc_qtoolbarlayout_p.cpp"
#endif // QT_NO_TOOLBAR

View File

@ -56,9 +56,9 @@
#include <private/qlayoutengine_p.h> #include <private/qlayoutengine_p.h>
#include <QVector> #include <QVector>
QT_BEGIN_NAMESPACE QT_REQUIRE_CONFIG(toolbar);
#ifndef QT_NO_TOOLBAR QT_BEGIN_NAMESPACE
class QAction; class QAction;
class QToolBarExtension; class QToolBarExtension;
@ -127,8 +127,6 @@ private:
QMenu *popupMenu; QMenu *popupMenu;
}; };
#endif // QT_NO_TOOLBAR
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QTOOLBARLAYOUT_P_H #endif // QTOOLBARLAYOUT_P_H

View File

@ -39,8 +39,6 @@
#include "qtoolbarseparator_p.h" #include "qtoolbarseparator_p.h"
#ifndef QT_NO_TOOLBAR
#include <qstyle.h> #include <qstyle.h>
#include <qstyleoption.h> #include <qstyleoption.h>
#include <qtoolbar.h> #include <qtoolbar.h>
@ -87,5 +85,3 @@ void QToolBarSeparator::paintEvent(QPaintEvent *)
QT_END_NAMESPACE QT_END_NAMESPACE
#include "moc_qtoolbarseparator_p.cpp" #include "moc_qtoolbarseparator_p.cpp"
#endif // QT_NO_TOOLBAR

View File

@ -54,9 +54,9 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtWidgets/qwidget.h" #include "QtWidgets/qwidget.h"
QT_BEGIN_NAMESPACE QT_REQUIRE_CONFIG(toolbar);
#ifndef QT_NO_TOOLBAR QT_BEGIN_NAMESPACE
class QStyleOption; class QStyleOption;
class QToolBar; class QToolBar;
@ -80,8 +80,6 @@ public Q_SLOTS:
void setOrientation(Qt::Orientation orientation); void setOrientation(Qt::Orientation orientation);
}; };
#endif // QT_NO_TOOLBAR
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QDYNAMICTOOLBARSEPARATOR_P_H #endif // QDYNAMICTOOLBARSEPARATOR_P_H

View File

@ -53,7 +53,9 @@
#if QT_CONFIG(mainwindow) #if QT_CONFIG(mainwindow)
#include <qmainwindow.h> #include <qmainwindow.h>
#endif #endif
#if QT_CONFIG(toolbar)
#include <qtoolbar.h> #include <qtoolbar.h>
#endif
#include <qvariant.h> #include <qvariant.h>
#include <qstylepainter.h> #include <qstylepainter.h>
#include <private/qabstractbutton_p.h> #include <private/qabstractbutton_p.h>
@ -201,7 +203,7 @@ void QToolButtonPrivate::init()
{ {
Q_Q(QToolButton); Q_Q(QToolButton);
defaultAction = 0; defaultAction = 0;
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
if (qobject_cast<QToolBar*>(parent)) if (qobject_cast<QToolBar*>(parent))
autoRaise = true; autoRaise = true;
else else
@ -245,13 +247,13 @@ void QToolButton::initStyleOption(QStyleOptionToolButton *option) const
bool forceNoText = false; bool forceNoText = false;
option->iconSize = iconSize(); //default value option->iconSize = iconSize(); //default value
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
if (parentWidget()) { if (parentWidget()) {
if (QToolBar *toolBar = qobject_cast<QToolBar *>(parentWidget())) { if (QToolBar *toolBar = qobject_cast<QToolBar *>(parentWidget())) {
option->iconSize = toolBar->iconSize(); option->iconSize = toolBar->iconSize();
} }
} }
#endif // QT_NO_TOOLBAR #endif // QT_CONFIG(toolbar)
if (!forceNoText) if (!forceNoText)
option->text = d->text; option->text = d->text;
@ -571,7 +573,7 @@ void QToolButton::timerEvent(QTimerEvent *e)
*/ */
void QToolButton::changeEvent(QEvent *e) void QToolButton::changeEvent(QEvent *e)
{ {
#ifndef QT_NO_TOOLBAR #if QT_CONFIG(toolbar)
Q_D(QToolButton); Q_D(QToolButton);
if (e->type() == QEvent::ParentChange) { if (e->type() == QEvent::ParentChange) {
if (qobject_cast<QToolBar*>(parentWidget())) if (qobject_cast<QToolBar*>(parentWidget()))
@ -743,7 +745,7 @@ void QToolButtonPrivate::popupTimerDone()
repeat = q->autoRepeat(); repeat = q->autoRepeat();
q->setAutoRepeat(false); q->setAutoRepeat(false);
bool horizontal = true; bool horizontal = true;
#if !defined(QT_NO_TOOLBAR) #if QT_CONFIG(toolbar)
QToolBar *tb = qobject_cast<QToolBar*>(parent); QToolBar *tb = qobject_cast<QToolBar*>(parent);
if (tb && tb->orientation() == Qt::Vertical) if (tb && tb->orientation() == Qt::Vertical)
horizontal = false; horizontal = false;

View File

@ -3,25 +3,16 @@
HEADERS += \ HEADERS += \
widgets/qframe.h \ widgets/qframe.h \
widgets/qframe_p.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.h \
widgets/qabstractscrollarea_p.h \ widgets/qabstractscrollarea_p.h \
widgets/qfocusframe.h \ widgets/qfocusframe.h \
widgets/qwidgetanimator_p.h \ widgets/qwidgetanimator_p.h
widgets/qtoolbararealayout_p.h
SOURCES += \ SOURCES += \
widgets/qframe.cpp \ widgets/qframe.cpp \
widgets/qtoolbar.cpp \
widgets/qtoolbarlayout.cpp \
widgets/qtoolbarseparator.cpp \
widgets/qabstractscrollarea.cpp \ widgets/qabstractscrollarea.cpp \
widgets/qfocusframe.cpp \ widgets/qfocusframe.cpp \
widgets/qwidgetanimator.cpp \ widgets/qwidgetanimator.cpp
widgets/qtoolbararealayout.cpp
qtConfig(abstractbutton) { qtConfig(abstractbutton) {
HEADERS += \ HEADERS += \
@ -326,6 +317,21 @@ qtConfig(tabwidget) {
SOURCES += widgets/qtabwidget.cpp 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) { qtConfig(toolbox) {
HEADERS += widgets/qtoolbox.h HEADERS += widgets/qtoolbox.h
SOURCES += widgets/qtoolbox.cpp SOURCES += widgets/qtoolbox.cpp