Convert features.slider to QT_[REQUIRE_]CONFIG

Change-Id: I03adb5e34071aa106bbfe7caa2d41a93e8d1e263
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Stephan Binner 2017-09-02 20:55:43 +02:00
parent 710a9180c1
commit 79bf70b5b6
14 changed files with 47 additions and 40 deletions

View File

@ -99,7 +99,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
} else if (classname == QLatin1String("QScrollBar")) { } else if (classname == QLatin1String("QScrollBar")) {
iface = new QAccessibleScrollBar(widget); iface = new QAccessibleScrollBar(widget);
#endif #endif
#ifndef QT_NO_SLIDER #if QT_CONFIG(slider)
} else if (classname == QLatin1String("QAbstractSlider")) { } else if (classname == QLatin1String("QAbstractSlider")) {
iface = new QAccessibleAbstractSlider(widget); iface = new QAccessibleAbstractSlider(widget);
} else if (classname == QLatin1String("QSlider")) { } else if (classname == QLatin1String("QSlider")) {

View File

@ -39,7 +39,9 @@
#include "rangecontrols_p.h" #include "rangecontrols_p.h"
#if QT_CONFIG(slider)
#include <qslider.h> #include <qslider.h>
#endif
#if QT_CONFIG(dial) #if QT_CONFIG(dial)
#include <qdial.h> #include <qdial.h>
#endif #endif
@ -325,7 +327,7 @@ QString QAccessibleScrollBar::text(QAccessible::Text t) const
#endif // QT_CONFIG(scrollbar) #endif // QT_CONFIG(scrollbar)
#ifndef QT_NO_SLIDER #if QT_CONFIG(slider)
/*! /*!
\class QAccessibleSlider \class QAccessibleSlider
\brief The QAccessibleSlider class implements the QAccessibleInterface for sliders. \brief The QAccessibleSlider class implements the QAccessibleInterface for sliders.
@ -402,7 +404,7 @@ QAbstractSlider *QAccessibleAbstractSlider::abstractSlider() const
return static_cast<QAbstractSlider *>(object()); return static_cast<QAbstractSlider *>(object());
} }
#endif // QT_NO_SLIDER #endif // QT_CONFIG(slider)
#if QT_CONFIG(dial) #if QT_CONFIG(dial)
// ======================================= QAccessibleDial ====================================== // ======================================= QAccessibleDial ======================================

View File

@ -174,7 +174,7 @@ protected:
}; };
#endif // QT_CONFIG(scrollbar) #endif // QT_CONFIG(scrollbar)
#ifndef QT_NO_SLIDER #if QT_CONFIG(slider)
class QAccessibleSlider : public QAccessibleAbstractSlider class QAccessibleSlider : public QAccessibleAbstractSlider
{ {
public: public:
@ -184,7 +184,7 @@ public:
protected: protected:
QSlider *slider() const; QSlider *slider() const;
}; };
#endif // QT_NO_SLIDER #endif // QT_CONFIG(slider)
#if QT_CONFIG(dial) #if QT_CONFIG(dial)
class QAccessibleDial : public QAccessibleAbstractSlider class QAccessibleDial : public QAccessibleAbstractSlider

View File

@ -69,7 +69,9 @@
#include <qpainter.h> #include <qpainter.h>
#include <qpaintengine.h> #include <qpaintengine.h>
#include <qpainterpath.h> #include <qpainterpath.h>
#if QT_CONFIG(slider)
#include <qslider.h> #include <qslider.h>
#endif
#include <qstyleoption.h> #include <qstyleoption.h>
#if QT_CONFIG(tabbar) #if QT_CONFIG(tabbar)
#include <qtabbar.h> #include <qtabbar.h>
@ -2472,7 +2474,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
r = visualRect(btn->direction, btn->rect, r); r = visualRect(btn->direction, btn->rect, r);
} }
break; break;
#ifndef QT_NO_SLIDER #if QT_CONFIG(slider)
case SE_SliderFocusRect: case SE_SliderFocusRect:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget); int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget);
@ -2485,7 +2487,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
r = visualRect(opt->direction, opt->rect, r); r = visualRect(opt->direction, opt->rect, r);
} }
break; break;
#endif // QT_NO_SLIDER #endif // QT_CONFIG(slider)
#if QT_CONFIG(progressbar) #if QT_CONFIG(progressbar)
case SE_ProgressBarGroove: case SE_ProgressBarGroove:
case SE_ProgressBarContents: case SE_ProgressBarContents:
@ -3140,7 +3142,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
QPainter *p, const QWidget *widget) const QPainter *p, const QWidget *widget) const
{ {
switch (cc) { switch (cc) {
#ifndef QT_NO_SLIDER #if QT_CONFIG(slider)
case CC_Slider: case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
if (slider->subControls == SC_SliderTickmarks) { if (slider->subControls == SC_SliderTickmarks) {
@ -3196,7 +3198,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
} }
} }
break; break;
#endif // QT_NO_SLIDER #endif // QT_CONFIG(slider)
#if QT_CONFIG(scrollbar) #if QT_CONFIG(scrollbar)
case CC_ScrollBar: case CC_ScrollBar:
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
@ -3822,7 +3824,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
{ {
SubControl sc = SC_None; SubControl sc = SC_None;
switch (cc) { switch (cc) {
#ifndef QT_NO_SLIDER #if QT_CONFIG(slider)
case CC_Slider: case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
QRect r = proxy()->subControlRect(cc, slider, SC_SliderHandle, widget); QRect r = proxy()->subControlRect(cc, slider, SC_SliderHandle, widget);
@ -3835,7 +3837,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
} }
} }
break; break;
#endif // QT_NO_SLIDER #endif // QT_CONFIG(slider)
#if QT_CONFIG(scrollbar) #if QT_CONFIG(scrollbar)
case CC_ScrollBar: case CC_ScrollBar:
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
@ -3959,7 +3961,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
{ {
QRect ret; QRect ret;
switch (cc) { switch (cc) {
#ifndef QT_NO_SLIDER #if QT_CONFIG(slider)
case CC_Slider: case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget); int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget);
@ -3994,7 +3996,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
ret = visualRect(slider->direction, slider->rect, ret); ret = visualRect(slider->direction, slider->rect, ret);
} }
break; break;
#endif // QT_NO_SLIDER #endif // QT_CONFIG(slider)
#if QT_CONFIG(scrollbar) #if QT_CONFIG(scrollbar)
case CC_ScrollBar: case CC_ScrollBar:
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
@ -4497,7 +4499,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
ret = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::MaximumScrollBarDragDistance).toInt(); ret = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::MaximumScrollBarDragDistance).toInt();
break; break;
#ifndef QT_NO_SLIDER #if QT_CONFIG(slider)
case PM_SliderThickness: case PM_SliderThickness:
ret = int(QStyleHelper::dpiScaled(16.)); ret = int(QStyleHelper::dpiScaled(16.));
break; break;
@ -4530,7 +4532,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
ret = 0; ret = 0;
} }
break; break;
#endif // QT_NO_SLIDER #endif // QT_CONFIG(slider)
#if QT_CONFIG(dockwidget) #if QT_CONFIG(dockwidget)
case PM_DockWidgetSeparatorExtent: case PM_DockWidgetSeparatorExtent:
ret = int(QStyleHelper::dpiScaled(6.)); ret = int(QStyleHelper::dpiScaled(6.));

View File

@ -72,7 +72,9 @@
#if QT_CONFIG(abstractslider) #if QT_CONFIG(abstractslider)
#include <qabstractslider.h> #include <qabstractslider.h>
#endif #endif
#if QT_CONFIG(slider)
#include <qslider.h> #include <qslider.h>
#endif
#if QT_CONFIG(splitter) #if QT_CONFIG(splitter)
#include <qsplitter.h> #include <qsplitter.h>
#endif #endif

View File

@ -52,7 +52,9 @@
#if QT_CONFIG(progressbar) #if QT_CONFIG(progressbar)
#include <QProgressBar> #include <QProgressBar>
#endif #endif
#if QT_CONFIG(slider)
#include <QSlider> #include <QSlider>
#endif
#include <QEvent> #include <QEvent>
#if QT_CONFIG(combobox) #if QT_CONFIG(combobox)
#include <QComboBox> #include <QComboBox>

View File

@ -1953,7 +1953,7 @@ QStyleOptionComplex::QStyleOptionComplex(int version, int type)
\sa QStyle::SubControl \sa QStyle::SubControl
*/ */
#ifndef QT_NO_SLIDER #if QT_CONFIG(slider)
/*! /*!
\class QStyleOptionSlider \class QStyleOptionSlider
\brief The QStyleOptionSlider class is used to describe the \brief The QStyleOptionSlider class is used to describe the
@ -2150,7 +2150,7 @@ QStyleOptionSlider::QStyleOptionSlider(int version)
\sa QAbstractSlider::pageStep \sa QAbstractSlider::pageStep
*/ */
#endif // QT_NO_SLIDER #endif // QT_CONFIG(slider)
#if QT_CONFIG(spinbox) #if QT_CONFIG(spinbox)
/*! /*!

View File

@ -48,7 +48,9 @@
#endif #endif
#include <QtGui/qicon.h> #include <QtGui/qicon.h>
#include <QtGui/qmatrix.h> #include <QtGui/qmatrix.h>
#if QT_CONFIG(slider)
#include <QtWidgets/qslider.h> #include <QtWidgets/qslider.h>
#endif
#include <QtWidgets/qstyle.h> #include <QtWidgets/qstyle.h>
#if QT_CONFIG(tabbar) #if QT_CONFIG(tabbar)
#include <QtWidgets/qtabbar.h> #include <QtWidgets/qtabbar.h>
@ -508,7 +510,7 @@ public:
QStyleOptionComplex(const QStyleOptionComplex &other) : QStyleOption(Version, Type) { *this = other; } QStyleOptionComplex(const QStyleOptionComplex &other) : QStyleOption(Version, Type) { *this = other; }
}; };
#ifndef QT_NO_SLIDER #if QT_CONFIG(slider)
class Q_WIDGETS_EXPORT QStyleOptionSlider : public QStyleOptionComplex class Q_WIDGETS_EXPORT QStyleOptionSlider : public QStyleOptionComplex
{ {
public: public:
@ -534,7 +536,7 @@ public:
protected: protected:
QStyleOptionSlider(int version); QStyleOptionSlider(int version);
}; };
#endif // QT_NO_SLIDER #endif // QT_CONFIG(slider)
#if QT_CONFIG(spinbox) #if QT_CONFIG(spinbox)
class Q_WIDGETS_EXPORT QStyleOptionSpinBox : public QStyleOptionComplex class Q_WIDGETS_EXPORT QStyleOptionSpinBox : public QStyleOptionComplex

View File

@ -3229,7 +3229,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
break; break;
#endif // QT_CONFIG(scrollbar) #endif // QT_CONFIG(scrollbar)
#ifndef QT_NO_SLIDER #if QT_CONFIG(slider)
case CC_Slider: case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
rule.drawRule(p, opt->rect); rule.drawRule(p, opt->rect);
@ -3283,7 +3283,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
return; return;
} }
break; break;
#endif // QT_NO_SLIDER #endif // QT_CONFIG(slider)
case CC_MdiControls: case CC_MdiControls:
if (hasStyleRule(w, PseudoElement_MdiCloseButton) if (hasStyleRule(w, PseudoElement_MdiCloseButton)
@ -5623,7 +5623,7 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp
break; break;
#endif // QT_CONFIG(scrollbar) #endif // QT_CONFIG(scrollbar)
#ifndef QT_NO_SLIDER #if QT_CONFIG(slider)
case CC_Slider: case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
QRenderRule subRule = renderRule(w, opt, PseudoElement_SliderGroove); QRenderRule subRule = renderRule(w, opt, PseudoElement_SliderGroove);
@ -5656,7 +5656,7 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp
} }
} }
break; break;
#endif // QT_NO_SLIDER #endif // QT_CONFIG(slider)
case CC_MdiControls: case CC_MdiControls:
if (hasStyleRule(w, PseudoElement_MdiCloseButton) if (hasStyleRule(w, PseudoElement_MdiCloseButton)

View File

@ -347,10 +347,10 @@ int QWindowsStylePrivate::fixedPixelMetric(QStyle::PixelMetric pm)
return 2; return 2;
#endif #endif
#ifndef QT_NO_SLIDER #if QT_CONFIG(slider)
case QStyle::PM_SliderLength: case QStyle::PM_SliderLength:
return 11; return 11;
#endif // QT_NO_SLIDER #endif // QT_CONFIG(slider)
#ifndef QT_NO_MENU #ifndef QT_NO_MENU
case QStyle::PM_MenuBarHMargin: case QStyle::PM_MenuBarHMargin:
@ -439,7 +439,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
ret = 60; ret = 60;
break; break;
#ifndef QT_NO_SLIDER #if QT_CONFIG(slider)
// Returns the number of pixels to use for the business part of the // Returns the number of pixels to use for the business part of the
// slider (i.e., the non-tickmark portion). The remaining space is shared // slider (i.e., the non-tickmark portion). The remaining space is shared
// equally between the tickmark regions. // equally between the tickmark regions.
@ -467,7 +467,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
ret = thick; ret = thick;
} }
break; break;
#endif // QT_NO_SLIDER #endif // QT_CONFIG(slider)
case PM_IconViewIconSize: case PM_IconViewIconSize:
ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget); ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget);
@ -1926,7 +1926,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
QPainter *p, const QWidget *widget) const QPainter *p, const QWidget *widget) const
{ {
switch (cc) { switch (cc) {
#ifndef QT_NO_SLIDER #if QT_CONFIG(slider)
case CC_Slider: case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget); int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
@ -2146,7 +2146,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
} }
} }
break; break;
#endif // QT_NO_SLIDER #endif // QT_CONFIG(slider)
#if QT_CONFIG(scrollbar) #if QT_CONFIG(scrollbar)
case CC_ScrollBar: case CC_ScrollBar:
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {

View File

@ -2724,7 +2724,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
} }
break; break;
#ifndef QT_NO_SLIDER #if QT_CONFIG(slider)
case CC_Slider: case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option))
{ {

View File

@ -38,7 +38,6 @@
****************************************************************************/ ****************************************************************************/
#include "qslider.h" #include "qslider.h"
#ifndef QT_NO_SLIDER
#ifndef QT_NO_ACCESSIBILITY #ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h" #include "qaccessible.h"
#endif #endif
@ -547,8 +546,6 @@ Q_WIDGETS_EXPORT QStyleOptionSlider qt_qsliderStyleOption(QSlider *slider)
return sliderOption; return sliderOption;
} }
#endif
QT_END_NAMESPACE QT_END_NAMESPACE
#include "moc_qslider.cpp" #include "moc_qslider.cpp"

View File

@ -42,12 +42,11 @@
#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qtwidgetsglobal.h>
#if QT_CONFIG(slider)
#include <QtWidgets/qabstractslider.h> #include <QtWidgets/qabstractslider.h>
QT_BEGIN_NAMESPACE QT_REQUIRE_CONFIG(slider);
QT_BEGIN_NAMESPACE
class QSliderPrivate; class QSliderPrivate;
class QStyleOptionSlider; class QStyleOptionSlider;
@ -102,6 +101,4 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_CONFIG(slider)
#endif // QSLIDER_H #endif // QSLIDER_H

View File

@ -5,7 +5,6 @@ HEADERS += \
widgets/qframe_p.h \ widgets/qframe_p.h \
widgets/qmenu.h \ widgets/qmenu.h \
widgets/qmenu_p.h \ widgets/qmenu_p.h \
widgets/qslider.h \
widgets/qtextedit.h \ widgets/qtextedit.h \
widgets/qtextedit_p.h \ widgets/qtextedit_p.h \
widgets/qtoolbar.h \ widgets/qtoolbar.h \
@ -23,7 +22,6 @@ HEADERS += \
SOURCES += \ SOURCES += \
widgets/qframe.cpp \ widgets/qframe.cpp \
widgets/qmenu.cpp \ widgets/qmenu.cpp \
widgets/qslider.cpp \
widgets/qtextedit.cpp \ widgets/qtextedit.cpp \
widgets/qtoolbar.cpp \ widgets/qtoolbar.cpp \
widgets/qtoolbarlayout.cpp \ widgets/qtoolbarlayout.cpp \
@ -257,6 +255,11 @@ qtConfig(sizegrip) {
SOURCES += widgets/qsizegrip.cpp SOURCES += widgets/qsizegrip.cpp
} }
qtConfig(slider) {
HEADERS += widgets/qslider.h
SOURCES += widgets/qslider.cpp
}
qtConfig(spinbox) { qtConfig(spinbox) {
HEADERS += \ HEADERS += \
widgets/qabstractspinbox.h \ widgets/qabstractspinbox.h \