aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickslider.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quicktemplates2/qquickslider.cpp')
-rw-r--r--src/quicktemplates2/qquickslider.cpp41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/quicktemplates2/qquickslider.cpp b/src/quicktemplates2/qquickslider.cpp
index 2bae9e72..454002c2 100644
--- a/src/quicktemplates2/qquickslider.cpp
+++ b/src/quicktemplates2/qquickslider.cpp
@@ -48,27 +48,30 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-input
- \brief Selects a value by sliding a handle along a track.
+ \brief Used to select a value by sliding a handle along a track.
\image qtquickcontrols2-slider.gif
Slider is used to select a value by sliding a handle along a track.
- \table
- \row \li \image qtquickcontrols2-slider-normal.png
- \li A slider in its normal state.
- \row \li \image qtquickcontrols2-slider-focused.png
- \li A slider that has active focus.
- \row \li \image qtquickcontrols2-slider-disabled.png
- \li A slider that is disabled.
- \endtable
+ In the example below, custom \l from, \l value, and \l to values are set:
\code
Slider {
- value: 0.5
+ from: 1
+ value: 25
+ to: 100
}
\endcode
+ The \l position property is expressed as a fraction of the control's size,
+ in the range \c {0.0 - 1.0}. The \l visualPosition property is
+ the same, except that it is reversed in a
+ \l {Right-to-left User Interfaces}{right-to-left} application. The
+ visualPosition is useful for positioning the handle when styling Slider.
+ In the example above, \l visualPosition will be \c 0.24 in a left-to-right
+ application, and \c 0.76 in a right-to-left application.
+
\sa {Customizing Slider}, {Input Controls}
*/
@@ -260,8 +263,8 @@ void QQuickSlider::setValue(qreal value)
This property holds the logical position of the handle.
- The position is defined as a percentage of the control's size, scaled
- to \c {0.0 - 1.0}. Unlike the \l value property, the \c position is
+ The position is expressed as a fraction of the control's size, in the range
+ \c {0.0 - 1.0}. Unlike the \l value property, the \c position is
continuously updated while the handle is dragged. For visualizing a
slider, the right-to-left aware \l visualPosition should be used instead.
@@ -279,7 +282,7 @@ qreal QQuickSlider::position() const
This property holds the visual position of the handle.
- The position is defined as a percentage of the control's size, scaled to
+ The position is expressed as a fraction of the control's size, in the range
\c {0.0 - 1.0}. When the control is \l {Control::mirrored}{mirrored}, the
value is equal to \c {1.0 - position}. This makes the value suitable for
visualizing the slider, taking right-to-left support into account.
@@ -327,6 +330,18 @@ void QQuickSlider::setStepSize(qreal step)
\value Slider.SnapAlways The slider snaps while the handle is dragged.
\value Slider.SnapOnRelease The slider does not snap while being dragged, but only after the handle is released.
+ In the following table, the various modes are illustrated with animations.
+ The movement of the mouse cursor and the \l stepSize (\c 0.2) are identical
+ in each animation.
+
+ \table
+ \header
+ \row \li \b Value \li \b Example
+ \row \li \c Slider.NoSnap \li \image qtquickcontrols2-slider-nosnap.gif
+ \row \li \c Slider.SnapAlways \li \image qtquickcontrols2-slider-snapalways.gif
+ \row \li \c Slider.SnapOnRelease \li \image qtquickcontrols2-slider-snaponrelease.gif
+ \endtable
+
\sa stepSize
*/
QQuickSlider::SnapMode QQuickSlider::snapMode() const