aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickscrollbar.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-11-03 16:00:13 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2016-11-03 16:00:13 +0100
commit3f646aca34c25f7cc36df2f988790bb238026422 (patch)
tree2f8c3022a7b7c1ec15db3ca528a3e7c604a18a63 /src/quicktemplates2/qquickscrollbar.cpp
parentc4a5b64abacad55e8b805bc1b1eaa877b0c945bb (diff)
parentd59476a0bb93c806c5dfb8bf998b50025ed4f852 (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts: tests/auto/accessibility/tst_accessibility.cpp Change-Id: I8c3ccb301730ecdc0acdcb75de607cdd4f753e15
Diffstat (limited to 'src/quicktemplates2/qquickscrollbar.cpp')
-rw-r--r--src/quicktemplates2/qquickscrollbar.cpp51
1 files changed, 49 insertions, 2 deletions
diff --git a/src/quicktemplates2/qquickscrollbar.cpp b/src/quicktemplates2/qquickscrollbar.cpp
index 5df4c4fb..8e6db063 100644
--- a/src/quicktemplates2/qquickscrollbar.cpp
+++ b/src/quicktemplates2/qquickscrollbar.cpp
@@ -65,9 +65,12 @@ QT_BEGIN_NAMESPACE
}
\endcode
+ \section1 Attaching ScrollBar to a Flickable
+
When ScrollBar is attached \l {ScrollBar::vertical}{vertically} or
- \l {ScrollBar::horizontal}{horizontally} to a Flickable, the following
- properties are automatically set and updated as appropriate:
+ \l {ScrollBar::horizontal}{horizontally} to a Flickable, its geometry and
+ the following properties are automatically set and updated as appropriate:
+
\list
\li \l orientation
\li \l position
@@ -113,6 +116,8 @@ QT_BEGIN_NAMESPACE
}
\endcode
+ \section1 Binding the Active State of Horizontal and Vertical Scroll Bars
+
Horizontal and vertical scroll bars do not share the \l active state with
each other by default. In order to keep both bars visible whilst scrolling
to either direction, establish a two-way binding between the active states
@@ -120,6 +125,29 @@ QT_BEGIN_NAMESPACE
\snippet qtquickcontrols2-scrollbar-active.qml 1
+ \section1 Non-attached Scroll Bars
+
+ It is possible to create an instance of ScrollBar without using the
+ attached property API. This is useful when the behavior of the attached
+ scoll bar is not sufficient or a \l Flickable is not in use. In the
+ following example, horizontal and vertical scroll bars are used to
+ scroll over the text without using \l Flickable:
+
+ \snippet qtquickcontrols2-scrollbar-non-attached.qml 1
+
+ \image qtquickcontrols2-scrollbar-non-attached.png
+
+ When using a non-attached ScrollBar, the following must be done manually:
+
+ \list
+ \li Layout the scroll bar (with the \l {Item::}{x} and \l {Item::}{y} or
+ \l {Item::anchors}{anchor} properties, for example).
+ \li Set the \l size and \l position properties to determine the size and position
+ of the scroll bar in relation to the scrolled item.
+ \li Set the \l active property to determine when the scroll bar will be
+ visible.
+ \endlist
+
\sa ScrollIndicator, {Customizing ScrollBar}, {Indicator Controls}
*/
@@ -205,6 +233,9 @@ QQuickScrollBarAttached *QQuickScrollBar::qmlAttachedProperties(QObject *object)
This property holds the size of the scroll bar, scaled to \c {0.0 - 1.0}.
\sa {Flickable::visibleArea.heightRatio}{Flickable::visibleArea}
+
+ This property is automatically set when the scroll bar is
+ \l {Attaching ScrollBar to a Flickable}{attached to a flickable}.
*/
qreal QQuickScrollBar::size() const
{
@@ -231,6 +262,9 @@ void QQuickScrollBar::setSize(qreal size)
This property holds the position of the scroll bar, scaled to \c {0.0 - 1.0}.
\sa {Flickable::visibleArea.yPosition}{Flickable::visibleArea}
+
+ This property is automatically set when the scroll bar is
+ \l {Attaching ScrollBar to a Flickable}{attached to a flickable}.
*/
qreal QQuickScrollBar::position() const
{
@@ -279,6 +313,12 @@ void QQuickScrollBar::setStepSize(qreal step)
This property holds whether the scroll bar is active, i.e. when it's \l pressed
or the attached Flickable is \l {Flickable::moving}{moving}.
+
+ It is possible to keep \l {Binding the Active State of Horizontal and Vertical Scroll Bars}
+ {both horizontal and vertical bars visible} while scrolling in either direction.
+
+ This property is automatically set when the scroll bar is
+ \l {Attaching ScrollBar to a Flickable}{attached to a flickable}.
*/
bool QQuickScrollBar::isActive() const
{
@@ -327,6 +367,9 @@ void QQuickScrollBar::setPressed(bool pressed)
Possible values:
\value Qt.Horizontal Horizontal
\value Qt.Vertical Vertical (default)
+
+ This property is automatically set when the scroll bar is
+ \l {Attaching ScrollBar to a Flickable}{attached to a flickable}.
*/
Qt::Orientation QQuickScrollBar::orientation() const
{
@@ -572,6 +615,8 @@ QQuickScrollBarAttached::~QQuickScrollBarAttached()
ScrollBar.horizontal: ScrollBar { }
}
\endcode
+
+ \sa {Attaching ScrollBar to a Flickable}
*/
QQuickScrollBar *QQuickScrollBarAttached::horizontal() const
{
@@ -630,6 +675,8 @@ void QQuickScrollBarAttached::setHorizontal(QQuickScrollBar *horizontal)
ScrollBar.vertical: ScrollBar { }
}
\endcode
+
+ \sa {Attaching ScrollBar to a Flickable}
*/
QQuickScrollBar *QQuickScrollBarAttached::vertical() const
{