Convert features.toolbutton to QT_[REQUIRE_]CONFIG

Change-Id: I4227e1868da21bded76a8ec55996c436c8a8d763
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Stephan Binner 2017-07-29 09:04:28 +02:00
parent e58fdbaeb0
commit ee29be91c0
18 changed files with 63 additions and 43 deletions

View File

@ -47,7 +47,9 @@
#include "itemviews_p.h"
#endif
#if QT_CONFIG(toolbutton)
#include <qtoolbutton.h>
#endif
#if QT_CONFIG(treeview)
#include <qtreeview.h>
#endif
@ -103,10 +105,10 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
} else if (classname == QLatin1String("QSlider")) {
iface = new QAccessibleSlider(widget);
#endif
#ifndef QT_NO_TOOLBUTTON
#if QT_CONFIG(toolbutton)
} else if (classname == QLatin1String("QToolButton")) {
iface = new QAccessibleToolButton(widget);
#endif // QT_NO_TOOLBUTTON
#endif // QT_CONFIG(toolbutton)
#if QT_CONFIG(abstractbutton)
} else if (classname == QLatin1String("QCheckBox")
|| classname == QLatin1String("QRadioButton")

View File

@ -57,7 +57,9 @@
#if QT_CONFIG(radiobutton)
#include <qradiobutton.h>
#endif
#if QT_CONFIG(toolbutton)
#include <qtoolbutton.h>
#endif
#include <qmenu.h>
#if QT_CONFIG(label)
#include <qlabel.h>
@ -280,7 +282,7 @@ QStringList QAccessibleButton::keyBindingsForAction(const QString &actionName) c
}
#endif // QT_CONFIG(abstractbutton)
#ifndef QT_NO_TOOLBUTTON
#if QT_CONFIG(toolbutton)
/*!
\class QAccessibleToolButton
\brief The QAccessibleToolButton class implements the QAccessibleInterface for tool buttons.
@ -400,7 +402,7 @@ void QAccessibleToolButton::doAction(const QString &actionName)
}
#endif // QT_NO_TOOLBUTTON
#endif // QT_CONFIG(toolbutton)
/*!
\class QAccessibleDisplay

View File

@ -86,7 +86,7 @@ protected:
};
#endif
#ifndef QT_NO_TOOLBUTTON
#if QT_CONFIG(toolbutton)
class QAccessibleToolButton : public QAccessibleButton
{
public:
@ -107,7 +107,7 @@ protected:
bool isSplitButton() const;
};
#endif // QT_NO_TOOLBUTTON
#endif // QT_CONFIG(toolbutton)
class QAccessibleDisplay : public QAccessibleWidget, public QAccessibleImageInterface
{

View File

@ -78,7 +78,9 @@
#include <qtabwidget.h>
#endif
#include <qtoolbar.h>
#if QT_CONFIG(toolbutton)
#include <qtoolbutton.h>
#endif
#if QT_CONFIG(rubberband)
#include <qrubberband.h>
#endif
@ -807,7 +809,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
}
}
#ifndef QT_NO_TOOLBUTTON
#if QT_CONFIG(toolbutton)
static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbutton,
const QRect &rect, QPainter *painter, const QWidget *widget = 0)
{
@ -832,7 +834,7 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut
arrowOpt.rect = rect;
style->drawPrimitive(pe, &arrowOpt, painter, widget);
}
#endif // QT_NO_TOOLBUTTON
#endif // QT_CONFIG(toolbutton)
#if QT_CONFIG(itemviews)
@ -1584,7 +1586,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
(header->state & State_Enabled), header->text, QPalette::ButtonText);
}
break;
#ifndef QT_NO_TOOLBUTTON
#if QT_CONFIG(toolbutton)
case CE_ToolButtonLabel:
if (const QStyleOptionToolButton *toolbutton
= qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
@ -1668,7 +1670,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
}
}
break;
#endif // QT_NO_TOOLBUTTON
#endif // QT_CONFIG(toolbutton)
#if QT_CONFIG(toolbox)
case CE_ToolBoxTab:
if (const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) {
@ -3353,7 +3355,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
}
break;
#endif // QT_NO_SPINBOX
#ifndef QT_NO_TOOLBUTTON
#if QT_CONFIG(toolbutton)
case CC_ToolButton:
if (const QStyleOptionToolButton *toolbutton
= qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
@ -3414,7 +3416,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
}
}
break;
#endif // QT_NO_TOOLBUTTON
#endif // QT_CONFIG(toolbutton)
case CC_TitleBar:
if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {
QRect ir;
@ -3855,7 +3857,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
}
break;
#endif // QT_CONFIG(scrollbar)
#ifndef QT_NO_TOOLBUTTON
#if QT_CONFIG(toolbutton)
case CC_ToolButton:
if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
QRect r;
@ -3870,7 +3872,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
}
}
break;
#endif // QT_NO_TOOLBUTTON
#endif // QT_CONFIG(toolbutton)
#ifndef QT_NO_SPINBOX
case CC_SpinBox:
if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
@ -4125,7 +4127,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
}
break;
#endif // Qt_NO_SPINBOX
#ifndef QT_NO_TOOLBUTTON
#if QT_CONFIG(toolbutton)
case CC_ToolButton:
if (const QStyleOptionToolButton *tb = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, tb, widget);
@ -4149,7 +4151,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
ret = visualRect(tb->direction, tb->rect, ret);
}
break;
#endif // QT_NO_TOOLBUTTON
#endif // QT_CONFIG(toolbutton)
#if QT_CONFIG(combobox)
case CC_ComboBox:
if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
@ -4844,11 +4846,11 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
}
break;
#endif // QT_NO_MENU
#ifndef QT_NO_TOOLBUTTON
#if QT_CONFIG(toolbutton)
case CT_ToolButton:
sz = QSize(sz.width() + 6, sz.height() + 5);
break;
#endif // QT_NO_TOOLBUTTON
#endif // QT_CONFIG(toolbutton)
#if QT_CONFIG(combobox)
case CT_ComboBox:
if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {

View File

@ -97,7 +97,9 @@
#include <qsizegrip.h>
#include <qstyleoption.h>
#include <qtoolbar.h>
#if QT_CONFIG(toolbutton)
#include <qtoolbutton.h>
#endif
#if QT_CONFIG(treeview)
#include <qtreeview.h>
#endif
@ -657,7 +659,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
else if (qobject_cast<const QComboBox *>(widg))
ct = QStyle::CT_ComboBox;
#endif
#ifndef QT_NO_TOOLBUTTON
#if QT_CONFIG(toolbutton)
else if (qobject_cast<const QToolButton *>(widg))
ct = QStyle::CT_ToolButton;
#endif
@ -792,7 +794,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
if (sz == QAquaSizeSmall) {
int width = 0, height = 0;
if (szHint == QSize(-1, -1)) { //just 'guess'..
#ifndef QT_NO_TOOLBUTTON
#if QT_CONFIG(toolbutton)
const QToolButton *bt = qobject_cast<const QToolButton *>(widg);
// If this conversion fails then the widget was not what it claimed to be.
if(bt) {

View File

@ -104,7 +104,9 @@
#include <qtextedit.h>
#include <qtextstream.h>
#include <qtoolbar.h>
#if QT_CONFIG(toolbutton)
#include <qtoolbutton.h>
#endif
#if QT_CONFIG(treeview)
#include <qtreeview.h>
#endif

View File

@ -60,7 +60,9 @@
#include "private/qabstractscrollarea_p.h"
#include <qtooltip.h>
#include <qshareddata.h>
#if QT_CONFIG(toolbutton)
#include <qtoolbutton.h>
#endif
#if QT_CONFIG(scrollbar)
#include <qscrollbar.h>
#endif
@ -4638,7 +4640,7 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const
switch (m) {
case PM_MenuButtonIndicator:
#ifndef QT_NO_TOOLBUTTON
#if QT_CONFIG(toolbutton)
// QToolButton adds this directly to the width
if (qobject_cast<const QToolButton *>(w) && (rule.hasBox() || !rule.hasNativeBorder()))
return 0;

View File

@ -69,7 +69,9 @@
#include <qradiobutton.h>
#include <qlineedit.h>
#include <qgroupbox.h>
#if QT_CONFIG(toolbutton)
#include <qtoolbutton.h>
#endif
#include <qspinbox.h>
#include <qtoolbar.h>
#if QT_CONFIG(combobox)

View File

@ -57,7 +57,9 @@
#include <qpa/qplatformnativeinterface.h>
#include <qdesktopwidget.h>
#if QT_CONFIG(toolbutton)
#include <qtoolbutton.h>
#endif
#if QT_CONFIG(tabbar)
#include <qtabbar.h>
#endif
@ -2853,7 +2855,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
}
break;
#endif
#ifndef QT_NO_TOOLBUTTON
#if QT_CONFIG(toolbutton)
case CC_ToolButton:
if (const QStyleOptionToolButton *toolbutton
= qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
@ -2967,7 +2969,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
}
}
break;
#endif // QT_NO_TOOLBUTTON
#endif // QT_CONFIG(toolbutton)
case CC_TitleBar:
{

View File

@ -56,7 +56,9 @@
#ifndef QT_NO_LINEEDIT
#include "private/qwidget_p.h"
#include "QtWidgets/qlineedit.h"
#if QT_CONFIG(toolbutton)
#include "QtWidgets/qtoolbutton.h"
#endif
#include "QtGui/qtextlayout.h"
#include "QtGui/qicon.h"
#include "QtWidgets/qstyleoption.h"

View File

@ -66,7 +66,9 @@
#include "qmenu_p.h"
#include "qmenubar_p.h"
#include "qwidgetaction.h"
#if QT_CONFIG(toolbutton)
#include "qtoolbutton.h"
#endif
#include "qpushbutton.h"
#include "qtooltip.h"
#include <private/qpushbutton_p.h>

View File

@ -51,7 +51,9 @@
#include <qevent.h>
#include <qmainwindow.h>
#include <qtoolbar.h>
#if QT_CONFIG(toolbutton)
#include <qtoolbutton.h>
#endif
#if QT_CONFIG(whatsthis)
#include <qwhatsthis.h>
#endif

View File

@ -43,8 +43,6 @@
#include <qstylepainter.h>
#include <qstyleoption.h>
#ifndef QT_NO_TOOLBUTTON
QT_BEGIN_NAMESPACE
QToolBarExtension::QToolBarExtension(QWidget *parent)
@ -88,5 +86,3 @@ QSize QToolBarExtension::sizeHint() const
QT_END_NAMESPACE
#include "moc_qtoolbarextension_p.cpp"
#endif // QT_NO_TOOLBUTTON

View File

@ -54,9 +54,9 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtWidgets/qtoolbutton.h"
QT_BEGIN_NAMESPACE
QT_REQUIRE_CONFIG(toolbutton);
#ifndef QT_NO_TOOLBUTTON
QT_BEGIN_NAMESPACE
class Q_AUTOTEST_EXPORT QToolBarExtension : public QToolButton
{
@ -71,8 +71,6 @@ public Q_SLOTS:
void setOrientation(Qt::Orientation o);
};
#endif // QT_NO_TOOLBUTTON
QT_END_NAMESPACE
#endif // QDYNAMICTOOLBAREXTENSION_P_H

View File

@ -42,7 +42,9 @@
#include <qwidgetaction.h>
#include <qtoolbar.h>
#include <qstyleoption.h>
#if QT_CONFIG(toolbutton)
#include <qtoolbutton.h>
#endif
#include <qmenu.h>
#include <qdebug.h>
#include <qmath.h>
@ -51,7 +53,9 @@
#endif
#include "qmainwindowlayout_p.h"
#if QT_CONFIG(toolbutton)
#include "qtoolbarextension_p.h"
#endif
#include "qtoolbarlayout_p.h"
#include "qtoolbarseparator_p.h"

View File

@ -38,7 +38,6 @@
****************************************************************************/
#include "qtoolbutton.h"
#ifndef QT_NO_TOOLBUTTON
#include <qapplication.h>
#include <qdesktopwidget.h>
@ -985,5 +984,3 @@ bool QToolButton::event(QEvent *event)
QT_END_NAMESPACE
#include "moc_qtoolbutton.cpp"
#endif

View File

@ -42,12 +42,11 @@
#include <QtWidgets/qtwidgetsglobal.h>
#if QT_CONFIG(toolbutton)
#include <QtWidgets/qabstractbutton.h>
QT_BEGIN_NAMESPACE
QT_REQUIRE_CONFIG(toolbutton);
QT_BEGIN_NAMESPACE
class QToolButtonPrivate;
class QMenu;
@ -137,6 +136,4 @@ private:
QT_END_NAMESPACE
#endif // QT_CONFIG(toolbutton)
#endif // QTOOLBUTTON_H

View File

@ -31,9 +31,7 @@ HEADERS += \
widgets/qtoolbar.h \
widgets/qtoolbar_p.h \
widgets/qtoolbarlayout_p.h \
widgets/qtoolbarextension_p.h \
widgets/qtoolbarseparator_p.h \
widgets/qtoolbutton.h \
widgets/qabstractscrollarea.h \
widgets/qabstractscrollarea_p.h \
widgets/qwidgetresizehandler_p.h \
@ -66,9 +64,7 @@ SOURCES += \
widgets/qtextedit.cpp \
widgets/qtoolbar.cpp \
widgets/qtoolbarlayout.cpp \
widgets/qtoolbarextension.cpp \
widgets/qtoolbarseparator.cpp \
widgets/qtoolbutton.cpp \
widgets/qabstractscrollarea.cpp \
widgets/qwidgetresizehandler.cpp \
widgets/qfocusframe.cpp \
@ -264,6 +260,16 @@ qtConfig(toolbox) {
SOURCES += widgets/qtoolbox.cpp
}
qtConfig(toolbutton) {
HEADERS += \
widgets/qtoolbutton.h \
widgets/qtoolbarextension_p.h
SOURCES += \
widgets/qtoolbutton.cpp \
widgets/qtoolbarextension.cpp
}
qtConfig(widgettextcontrol) {
HEADERS += \
widgets/qwidgettextcontrol_p.h \