Skip to content

Commit

Permalink
Convert features.progressbar to QT_[REQUIRE_]CONFIG
Browse files Browse the repository at this point in the history
Change-Id: I66d00d5bac98ff337ba5877e5f23be5e14a97551
Reviewed-by: Oswald Buddenhagen <[email protected]>
  • Loading branch information
sbinner committed Aug 10, 2017
1 parent fab3261 commit 0987bda
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/widgets/accessible/qaccessiblewidgetfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
#endif
} else if (classname == QLatin1String("QStatusBar")) {
iface = new QAccessibleDisplay(widget);
#ifndef QT_NO_PROGRESSBAR
#if QT_CONFIG(progressbar)
} else if (classname == QLatin1String("QProgressBar")) {
iface = new QAccessibleProgressBar(widget);
#endif
Expand Down
8 changes: 5 additions & 3 deletions src/widgets/accessible/simplewidgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
#if QT_CONFIG(pushbutton)
#include <qpushbutton.h>
#endif
#if QT_CONFIG(progressbar)
#include <qprogressbar.h>
#endif
#if QT_CONFIG(statusbar)
#include <qstatusbar.h>
#endif
Expand Down Expand Up @@ -430,7 +432,7 @@ QAccessible::Role QAccessibleDisplay::role() const
if (l->movie())
return QAccessible::Animation;
#endif
#ifndef QT_NO_PROGRESSBAR
#if QT_CONFIG(progressbar)
} else if (qobject_cast<QProgressBar*>(object())) {
return QAccessible::ProgressBar;
#endif
Expand Down Expand Up @@ -484,7 +486,7 @@ QString QAccessibleDisplay::text(QAccessible::Text t) const
}
break;
case QAccessible::Value:
#ifndef QT_NO_PROGRESSBAR
#if QT_CONFIG(progressbar)
if (qobject_cast<QProgressBar*>(object()))
str = QString::number(qobject_cast<QProgressBar*>(object())->value());
#endif
Expand Down Expand Up @@ -891,7 +893,7 @@ void QAccessibleLineEdit::replaceText(int startOffset, int endOffset, const QStr

#endif // QT_NO_LINEEDIT

#ifndef QT_NO_PROGRESSBAR
#if QT_CONFIG(progressbar)
QAccessibleProgressBar::QAccessibleProgressBar(QWidget *o)
: QAccessibleDisplay(o)
{
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/accessible/simplewidgets_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class QAccessibleLineEdit : public QAccessibleWidget, public QAccessibleTextInte
};
#endif // QT_NO_LINEEDIT

#ifndef QT_NO_PROGRESSBAR
#if QT_CONFIG(progressbar)
class QAccessibleProgressBar : public QAccessibleDisplay, public QAccessibleValueInterface
{
public:
Expand Down
12 changes: 6 additions & 6 deletions src/widgets/styles/qcommonstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
case PE_PanelToolBar:
break;
#endif // QT_NO_TOOLBAR
#ifndef QT_NO_PROGRESSBAR
#if QT_CONFIG(progressbar)
case PE_IndicatorProgressChunk:
{
bool vertical = false;
Expand All @@ -303,7 +303,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
}
}
break;
#endif // QT_NO_PROGRESSBAR
#endif // QT_CONFIG(progressbar)
case PE_IndicatorBranch: {
static const int decoration_size = 9;
int mid_h = opt->rect.x() + opt->rect.width() / 2;
Expand Down Expand Up @@ -1414,7 +1414,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
p->eraseRect(opt->rect);
break;
#endif // QT_NO_MENUBAR
#ifndef QT_NO_PROGRESSBAR
#if QT_CONFIG(progressbar)
case CE_ProgressBar:
if (const QStyleOptionProgressBar *pb
= qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
Expand Down Expand Up @@ -1551,7 +1551,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
}
}
break;
#endif // QT_NO_PROGRESSBAR
#endif // QT_CONFIG(progressbar)
case CE_HeaderLabel:
if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
QRect rect = header->rect;
Expand Down Expand Up @@ -2487,7 +2487,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
}
break;
#endif // QT_NO_SLIDER
#ifndef QT_NO_PROGRESSBAR
#if QT_CONFIG(progressbar)
case SE_ProgressBarGroove:
case SE_ProgressBarContents:
case SE_ProgressBarLabel:
Expand All @@ -2512,7 +2512,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
r = visualRect(pb->direction, pb->rect, r);
}
break;
#endif // QT_NO_PROGRESSBAR
#endif // QT_CONFIG(progressbar)
#if QT_CONFIG(combobox)
case SE_ComboBoxFocusRect:
if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
Expand Down
2 changes: 2 additions & 0 deletions src/widgets/styles/qfusionstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@
#endif
#include <qslider.h>
#include <qsplitter.h>
#if QT_CONFIG(progressbar)
#include <qprogressbar.h>
#endif
#if QT_CONFIG(wizard)
#include <qwizard.h>
#endif
Expand Down
6 changes: 4 additions & 2 deletions src/widgets/styles/qmacstyle_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@
#include <qpainter.h>
#include <qpixmapcache.h>
#include <qpointer.h>
#if QT_CONFIG(progressbar)
#include <qprogressbar.h>
#endif
#if QT_CONFIG(pushbutton)
#include <qpushbutton.h>
#endif
Expand Down Expand Up @@ -659,7 +661,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
#endif
else if (qobject_cast<const QSlider *>(widg))
ct = QStyle::CT_Slider;
#ifndef QT_NO_PROGRESSBAR
#if QT_CONFIG(progressbar)
else if (qobject_cast<const QProgressBar *>(widg))
ct = QStyle::CT_ProgressBar;
#endif
Expand Down Expand Up @@ -875,7 +877,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
ret.setWidth(w);
break;
}
#ifndef QT_NO_PROGRESSBAR
#if QT_CONFIG(progressbar)
case QStyle::CT_ProgressBar: {
int finalValue = -1;
Qt::Orientation orient = Qt::Horizontal;
Expand Down
2 changes: 2 additions & 0 deletions src/widgets/styles/qmacstyle_mac_p_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@
#include <qpainter.h>
#include <qpixmapcache.h>
#include <qpointer.h>
#if QT_CONFIG(progressbar)
#include <qprogressbar.h>
#endif
#if QT_CONFIG(pushbutton)
#include <qpushbutton.h>
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/widgets/styles/qpixmapstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
#include <QPixmapCache>
#include <QStyleOption>
#include <QString>
#if QT_CONFIG(progressbar)
#include <QProgressBar>
#endif
#include <QSlider>
#include <QEvent>
#if QT_CONFIG(combobox)
Expand Down
2 changes: 2 additions & 0 deletions src/widgets/styles/qwindowsvistastyle_p_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@
#include <qcombobox.h>
#endif
#include <qscrollbar.h>
#if QT_CONFIG(progressbar)
#include <qprogressbar.h>
#endif
#if QT_CONFIG(dockwidget)
#include <qdockwidget.h>
#endif
Expand Down
4 changes: 1 addition & 3 deletions src/widgets/widgets/qprogressbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
****************************************************************************/

#include "qprogressbar.h"
#ifndef QT_NO_PROGRESSBAR

#include <qlocale.h>
#include <qevent.h>
#include <qpainter.h>
Expand Down Expand Up @@ -623,5 +623,3 @@ QString QProgressBar::format() const
QT_END_NAMESPACE

#include "moc_qprogressbar.cpp"

#endif // QT_NO_PROGRESSBAR
7 changes: 2 additions & 5 deletions src/widgets/widgets/qprogressbar.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qframe.h>

QT_BEGIN_NAMESPACE

QT_REQUIRE_CONFIG(progressbar);

#ifndef QT_NO_PROGRESSBAR
QT_BEGIN_NAMESPACE

class QProgressBarPrivate;
class QStyleOptionProgressBar;
Expand Down Expand Up @@ -119,8 +118,6 @@ public Q_SLOTS:
Q_DISABLE_COPY(QProgressBar)
};

#endif // QT_NO_PROGRESSBAR

QT_END_NAMESPACE

#endif // QPROGRESSBAR_H
7 changes: 5 additions & 2 deletions src/widgets/widgets/widgets.pri
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ HEADERS += \
widgets/qmenu_p.h \
widgets/qmenubar.h \
widgets/qmenubar_p.h \
widgets/qprogressbar.h \
widgets/qscrollbar.h \
widgets/qscrollbar_p.h \
widgets/qscrollarea_p.h \
Expand Down Expand Up @@ -67,7 +66,6 @@ SOURCES += \
widgets/qmdisubwindow.cpp \
widgets/qmenu.cpp \
widgets/qmenubar.cpp \
widgets/qprogressbar.cpp \
widgets/qscrollbar.cpp \
widgets/qsizegrip.cpp \
widgets/qslider.cpp \
Expand Down Expand Up @@ -184,6 +182,11 @@ qtConfig(lcdnumber) {
widgets/qlcdnumber.cpp
}

qtConfig(progressbar) {
HEADERS += widgets/qprogressbar.h
SOURCES += widgets/qprogressbar.cpp
}

qtConfig(pushbutton) {
HEADERS += \
widgets/qpushbutton.h \
Expand Down

0 comments on commit 0987bda

Please sign in to comment.