From 113d6f0670482706fd8184128175ad19cfd0c4a9 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 28 Mar 2017 12:44:53 +0200 Subject: 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 --- src/quicktemplates2/qquickscrollbar.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/quicktemplates2/qquickscrollbar.cpp') 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 { @@ -542,6 +544,36 @@ void QQuickScrollBar::setPolicy(Policy policy) emit policyChanged(); } +/*! + \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() -- cgit v1.2.3