diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-03-28 12:44:53 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-03-28 11:12:41 +0000 |
commit | 113d6f0670482706fd8184128175ad19cfd0c4a9 (patch) | |
tree | f0bc04ef0b62c8ef4b6961b5b9ef45919a9f810e /src/quicktemplates2/qquickscrollbar.cpp | |
parent | befa702ce798b35085594233520359e12e2e79e1 (diff) |
ScrollBar: add horizontal and vertical properties for convenience
[ChangeLog][Controls][ScrollBar] Added horizontal and vertical
properties to make it more convenient to create orientation-dependent
bindings in styles.
Change-Id: Id48d17021b663f00d242ffbde06b76407b832f81
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickscrollbar.cpp')
-rw-r--r-- | src/quicktemplates2/qquickscrollbar.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickscrollbar.cpp b/src/quicktemplates2/qquickscrollbar.cpp index 3dcb720a..9aeec74f 100644 --- a/src/quicktemplates2/qquickscrollbar.cpp +++ b/src/quicktemplates2/qquickscrollbar.cpp @@ -422,6 +422,8 @@ void QQuickScrollBar::setPressed(bool pressed) This property is automatically set when the scroll bar is \l {Attaching ScrollBar to a Flickable}{attached to a flickable}. + + \sa horizontal, vertical */ Qt::Orientation QQuickScrollBar::orientation() const { @@ -543,6 +545,36 @@ void QQuickScrollBar::setPolicy(Policy policy) } /*! + \since QtQuick.Controls 2.3 + \qmlproperty bool QtQuick.Controls::ScrollBar::horizontal + \readonly + + This property holds whether the scroll bar is horizontal. + + \sa orientation +*/ +bool QQuickScrollBar::isHorizontal() const +{ + Q_D(const QQuickScrollBar); + return d->orientation == Qt::Horizontal; +} + +/*! + \since QtQuick.Controls 2.3 + \qmlproperty bool QtQuick.Controls::ScrollBar::vertical + \readonly + + This property holds whether the scroll bar is vertical. + + \sa orientation +*/ +bool QQuickScrollBar::isVertical() const +{ + Q_D(const QQuickScrollBar); + return d->orientation == Qt::Vertical; +} + +/*! \qmlmethod void QtQuick.Controls::ScrollBar::increase() Increases the position by \l stepSize or \c 0.1 if stepSize is \c 0.0. |