diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-03-28 12:36:51 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-03-28 11:12:38 +0000 |
commit | befa702ce798b35085594233520359e12e2e79e1 (patch) | |
tree | 05c05639fd3b8b458f607be9387bf8b7d8897342 /src/quicktemplates2 | |
parent | 72e12f8e5ee54a919c254000a017f3f918825406 (diff) |
RangeSlider: add horizontal and vertical properties for convenience
[ChangeLog][Controls][RangeSlider] Added horizontal and vertical
properties to make it more convenient to create orientation-dependent
bindings in styles.
Change-Id: Iac2ae7d4d701cf9516521923cf27416d76dfba5c
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r-- | src/quicktemplates2/qquickrangeslider.cpp | 32 | ||||
-rw-r--r-- | src/quicktemplates2/qquickrangeslider_p.h | 5 |
2 files changed, 37 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickrangeslider.cpp b/src/quicktemplates2/qquickrangeslider.cpp index 1c74f9ee..175ca06e 100644 --- a/src/quicktemplates2/qquickrangeslider.cpp +++ b/src/quicktemplates2/qquickrangeslider.cpp @@ -757,6 +757,8 @@ void QQuickRangeSlider::setSnapMode(SnapMode mode) Possible values: \value Qt.Horizontal Horizontal (default) \value Qt.Vertical Vertical + + \sa horizontal, vertical */ Qt::Orientation QQuickRangeSlider::orientation() const { @@ -775,6 +777,36 @@ void QQuickRangeSlider::setOrientation(Qt::Orientation orientation) } /*! + \since QtQuick.Controls 2.3 + \qmlproperty bool QtQuick.Controls::RangeSlider::horizontal + \readonly + + This property holds whether the slider is horizontal. + + \sa orientation +*/ +bool QQuickRangeSlider::isHorizontal() const +{ + Q_D(const QQuickRangeSlider); + return d->orientation == Qt::Horizontal; +} + +/*! + \since QtQuick.Controls 2.3 + \qmlproperty bool QtQuick.Controls::RangeSlider::vertical + \readonly + + This property holds whether the slider is vertical. + + \sa orientation +*/ +bool QQuickRangeSlider::isVertical() const +{ + Q_D(const QQuickRangeSlider); + return d->orientation == Qt::Vertical; +} + +/*! \since QtQuick.Controls 2.2 \qmlproperty bool QtQuick.Controls::RangeSlider::live diff --git a/src/quicktemplates2/qquickrangeslider_p.h b/src/quicktemplates2/qquickrangeslider_p.h index d07cb6f0..affb734a 100644 --- a/src/quicktemplates2/qquickrangeslider_p.h +++ b/src/quicktemplates2/qquickrangeslider_p.h @@ -65,6 +65,8 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickRangeSlider : public QQuickControl Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL) Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL) Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL) + Q_PROPERTY(bool horizontal READ isHorizontal NOTIFY orientationChanged FINAL REVISION 3) + Q_PROPERTY(bool vertical READ isVertical NOTIFY orientationChanged FINAL REVISION 3) Q_PROPERTY(bool live READ live WRITE setLive NOTIFY liveChanged FINAL REVISION 2) public: @@ -95,6 +97,9 @@ public: Qt::Orientation orientation() const; void setOrientation(Qt::Orientation orientation); + bool isHorizontal() const; + bool isVertical() const; + bool live() const; void setLive(bool live); |