Skip to content

Commit

Permalink
Add feature.abstractslider
Browse files Browse the repository at this point in the history
Change-Id: Ib5d0186162fc3b750e6440c74b1181787093ef97
Reviewed-by: Paul Olav Tvete <[email protected]>
  • Loading branch information
sbinner committed Mar 8, 2017
1 parent cf7d3b5 commit b53d766
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 16 deletions.
7 changes: 7 additions & 0 deletions src/widgets/configure.json
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,17 @@
"section": "Widgets",
"output": [ "publicFeature", "feature" ]
},
"abstractslider": {
"label": "QAbstractSlider",
"purpose": "Common super class for widgets like QScrollBar, QSlider and QDial.",
"section": "Widgets",
"output": [ "publicFeature" ]
},
"slider": {
"label": "QSlider",
"purpose": "Provides sliders controlling a bounded value.",
"section": "Widgets",
"condition": "features.abstractslider",
"output": [ "publicFeature", "feature" ]
},
"scrollbar": {
Expand Down
4 changes: 4 additions & 0 deletions src/widgets/styles/qfusionstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3294,7 +3294,9 @@ void QFusionStyle::polish(QWidget *widget)
#if QT_CONFIG(splitter)
|| qobject_cast<QSplitterHandle *>(widget)
#endif
#if QT_CONFIG(abstractslider)
|| qobject_cast<QAbstractSlider *>(widget)
#endif
#if QT_CONFIG(spinbox)
|| qobject_cast<QAbstractSpinBox *>(widget)
#endif
Expand Down Expand Up @@ -3333,7 +3335,9 @@ void QFusionStyle::unpolish(QWidget *widget)
#if QT_CONFIG(splitter)
|| qobject_cast<QSplitterHandle *>(widget)
#endif
#if QT_CONFIG(abstractslider)
|| qobject_cast<QAbstractSlider *>(widget)
#endif
#if QT_CONFIG(spinbox)
|| qobject_cast<QAbstractSpinBox *>(widget)
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/widgets/styles/qstylesheetstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2426,9 +2426,11 @@ static bool unstylable(const QWidget *w)
static quint64 extendedPseudoClass(const QWidget *w)
{
quint64 pc = w->isWindow() ? quint64(PseudoClass_Window) : 0;
#if QT_CONFIG(abstractslider)
if (const QAbstractSlider *slider = qobject_cast<const QAbstractSlider *>(w)) {
pc |= ((slider->orientation() == Qt::Vertical) ? PseudoClass_Vertical : PseudoClass_Horizontal);
} else
#endif
#ifndef QT_NO_COMBOBOX
if (const QComboBox *combo = qobject_cast<const QComboBox *>(w)) {
if (combo->isEditable())
Expand Down
2 changes: 2 additions & 0 deletions src/widgets/widgets/qabstractslider.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>

QT_REQUIRE_CONFIG(abstractslider);

QT_BEGIN_NAMESPACE


Expand Down
2 changes: 2 additions & 0 deletions src/widgets/widgets/qabstractslider_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
#include "private/qwidget_p.h"
#include "qstyle.h"

QT_REQUIRE_CONFIG(abstractslider);

QT_BEGIN_NAMESPACE

class QAbstractSliderPrivate : public QWidgetPrivate
Expand Down
9 changes: 5 additions & 4 deletions src/widgets/widgets/qdial.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@
#define QDIAL_H

#include <QtWidgets/qtwidgetsglobal.h>

#if QT_CONFIG(dial)

#include <QtWidgets/qabstractslider.h>

QT_BEGIN_NAMESPACE


#ifndef QT_NO_DIAL

class QDialPrivate;
class QStyleOptionSlider;

Expand Down Expand Up @@ -98,8 +99,8 @@ public Q_SLOTS:
Q_DISABLE_COPY(QDial)
};

#endif // QT_NO_DIAL

QT_END_NAMESPACE

#endif // QT_CONFIG(dial)

#endif // QDIAL_H
10 changes: 5 additions & 5 deletions src/widgets/widgets/qscrollbar.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@

#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
#include <QtWidgets/qabstractslider.h>

QT_BEGIN_NAMESPACE
#if QT_CONFIG(scrollbar)

#include <QtWidgets/qabstractslider.h>

#ifndef QT_NO_SCROLLBAR
QT_BEGIN_NAMESPACE

class QScrollBarPrivate;
class QStyleOptionSlider;
Expand Down Expand Up @@ -94,8 +94,8 @@ class Q_WIDGETS_EXPORT QScrollBar : public QAbstractSlider
#endif
};

#endif // QT_NO_SCROLLBAR

QT_END_NAMESPACE

#endif // QT_CONFIG(scrollbar)

#endif // QSCROLLBAR_H
9 changes: 5 additions & 4 deletions src/widgets/widgets/qslider.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@
#define QSLIDER_H

#include <QtWidgets/qtwidgetsglobal.h>

#if QT_CONFIG(slider)

#include <QtWidgets/qabstractslider.h>

QT_BEGIN_NAMESPACE


#ifndef QT_NO_SLIDER

class QSliderPrivate;
class QStyleOptionSlider;
class Q_WIDGETS_EXPORT QSlider : public QAbstractSlider
Expand Down Expand Up @@ -99,8 +100,8 @@ class Q_WIDGETS_EXPORT QSlider : public QAbstractSlider
Q_DECLARE_PRIVATE(QSlider)
};

#endif // QT_NO_SLIDER

QT_END_NAMESPACE

#endif // QT_CONFIG(slider)

#endif // QSLIDER_H
12 changes: 9 additions & 3 deletions src/widgets/widgets/widgets.pri
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ HEADERS += \
widgets/qbuttongroup_p.h \
widgets/qabstractbutton.h \
widgets/qabstractbutton_p.h \
widgets/qabstractslider.h \
widgets/qabstractslider_p.h \
widgets/qabstractspinbox.h \
widgets/qabstractspinbox_p.h \
widgets/qcalendarwidget.h \
Expand Down Expand Up @@ -79,7 +77,6 @@ HEADERS += \
SOURCES += \
widgets/qbuttongroup.cpp \
widgets/qabstractbutton.cpp \
widgets/qabstractslider.cpp \
widgets/qabstractspinbox.cpp \
widgets/qcalendarwidget.cpp \
widgets/qcombobox.cpp \
Expand Down Expand Up @@ -131,6 +128,15 @@ SOURCES += \
widgets/qtoolbararealayout.cpp \
widgets/qplaintextedit.cpp

qtConfig(abstractslider) {
HEADERS += \
widgets/qabstractslider.h \
widgets/qabstractslider_p.h

SOURCES += \
widgets/qabstractslider.cpp
}

qtConfig(checkbox) {
HEADERS += \
widgets/qcheckbox.h
Expand Down

0 comments on commit b53d766

Please sign in to comment.