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 <qtextedit.h>
#include <qtextstream.h>
#if QT_CONFIG(toolbar)
#include <qtoolbar.h>
#endif
#if QT_CONFIG(toolbutton)
#include <qtoolbutton.h>
#endif

View File

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

View File

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

View File

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

View File

@ -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"

View File

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

View File

@ -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:

View File

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

View File

@ -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
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -44,11 +44,10 @@
#include <QtWidgets/qaction.h>
#include <QtWidgets/qwidget.h>
QT_REQUIRE_CONFIG(toolbar);
QT_BEGIN_NAMESPACE
#ifndef QT_NO_TOOLBAR
class QToolBarPrivate;
class QAction;
@ -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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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