Commit 0e813312 authored by Jens Bache-Wiig's avatar Jens Bache-Wiig Committed by The Qt Project
Browse files

Add documentation for Slider


Change-Id: I814323cba00b34480be3d8220fde398ce80d5de9
Reviewed-by: default avatarJ-P Nurmi <jpnurmi@digia.com>
Reviewed-by: default avatarJens Bache-Wiig <jens.bache-wiig@digia.com>
parent 9fafddcf
6.2 5.10 5.11 5.12 5.12.1 5.12.10 5.12.11 5.12.12 5.12.2 5.12.3 5.12.4 5.12.5 5.12.6 5.12.7 5.12.8 5.12.9 5.13 5.13.0 5.13.1 5.13.2 5.14 5.14.0 5.14.1 5.14.2 5.15 5.15.0 5.15.1 5.15.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 5.9.8 dev old/5.1 old/5.2 wip/calendar wip/tizen v5.15.0-alpha1 v5.14.1 v5.14.0 v5.14.0-rc2 v5.14.0-rc1 v5.14.0-beta3 v5.14.0-beta2 v5.14.0-beta1 v5.14.0-alpha1 v5.13.2 v5.13.1 v5.13.0 v5.13.0-rc3 v5.13.0-rc2 v5.13.0-rc1 v5.13.0-beta4 v5.13.0-beta3 v5.13.0-beta2 v5.13.0-beta1 v5.13.0-alpha1 v5.12.7 v5.12.6 v5.12.5 v5.12.4 v5.12.3 v5.12.2 v5.12.1 v5.12.0 v5.12.0-rc2 v5.12.0-rc1 v5.12.0-beta4 v5.12.0-beta3 v5.12.0-beta2 v5.12.0-beta1 v5.12.0-alpha1 v5.11.3 v5.11.2 v5.11.1 v5.11.0 v5.11.0-rc2 v5.11.0-rc1 v5.11.0-beta4 v5.11.0-beta3 v5.11.0-beta2 v5.11.0-beta1 v5.11.0-alpha1 v5.10.1 v5.10.0 v5.10.0-rc3 v5.10.0-rc2 v5.10.0-rc1 v5.10.0-beta4 v5.10.0-beta3 v5.10.0-beta2 v5.10.0-beta1 v5.10.0-alpha1 v5.9.9 v5.9.8 v5.9.7 v5.9.6 v5.9.5 v5.9.4 v5.9.3 v5.9.2 v5.9.1 v5.9.0 v5.9.0-rc2 v5.9.0-rc1 v5.9.0-beta4 v5.9.0-beta3 v5.9.0-beta2 v5.9.0-beta1 v5.9.0-alpha1 v5.8.0 v5.8.0-rc1 v5.8.0-beta1 v5.8.0-alpha1 v5.7.1 v5.7.0 v5.7.0-rc1 v5.7.0-beta1 v5.7.0-alpha1 v5.6.3 v5.6.2 v5.6.1 v5.6.1-1 v5.6.0 v5.6.0-rc1 v5.6.0-beta1 v5.6.0-alpha1 v5.5.1 v5.5.0 v5.5.0-rc1 v5.5.0-beta1 v5.5.0-alpha1 v5.4.2 v5.4.1 v5.4.0 v5.4.0-rc1 v5.4.0-beta1 v5.4.0-alpha1 v5.3.2 v5.3.1 v5.3.0 v5.3.0-rc1 v5.3.0-beta1 v5.3.0-alpha1 v5.2.1 v5.2.0 v5.2.0-rc1 v5.2.0-beta1 v5.2.0-alpha1 v5.1.1 v5.1.0 v5.1.0-rc2 v5.1.0-rc1 v5.1.0-beta1 v5.1.0-alpha1
No related merge requests found
Showing with 114 additions and 8 deletions
...@@ -42,44 +42,150 @@ import QtQuick 2.0 ...@@ -42,44 +42,150 @@ import QtQuick 2.0
import QtDesktop 1.0 import QtDesktop 1.0
import "Styles/Settings.js" as Settings import "Styles/Settings.js" as Settings
// jens: ContainsMouse breaks drag functionality
/*! /*!
\qmltype Slider \qmltype Slider
\inqmlmodule QtDesktop 1.0 \inqmlmodule QtDesktop 1.0
\brief Slider is doing bla...bla... \brief Slider provides a vertical or horizontal slider control.
The slider is the classic control for providing a bounded value. It lets
the user move a slider handle along a horizontal or vertical groove
and translates the handle's position into a value within the legal range.
\code
Slider {
onValueChanged: print(value)
}
\endcode
The Slider value is by default in the range [0, 1]. If integer values are
needed, you can set the \l stepSize.
*/ */
Item { Item {
id: slider id: slider
// Common API /*!
\qmlproperty enum Slider::orientation
This property holds the layout orientation of the slider.
The default value is \code Qt.Horizontal
*/
property int orientation: Qt.Horizontal property int orientation: Qt.Horizontal
/*!
\qmlproperty double Slider::minimumValue
This property holds the minimum value of the Slider
The default value is \code 0.0
*/
property alias minimumValue: range.minimumValue property alias minimumValue: range.minimumValue
/*!
\qmlproperty double Slider::maximumValue
This property holds the maximum value of the Slider
The default value is \code 1.0
*/
property alias maximumValue: range.maximumValue property alias maximumValue: range.maximumValue
/* \internal */
property alias inverted: range.inverted property alias inverted: range.inverted
/*!
\qmlproperty bool Slider::updateValueWhileDragging
This property indicates if the current \l value should update while
the user is moving the slider handle or only when the button has been released.
The property can for instance be used if changing the slider value can be
time consuming.
The default value is \code true
*/
property bool updateValueWhileDragging: true property bool updateValueWhileDragging: true
/*!
\qmlproperty bool Slider::pressed
This property indicates if slider handle is currently being pressed
*/
property alias pressed: mouseArea.pressed property alias pressed: mouseArea.pressed
/*!
\qmlproperty double Slider::stepSize
This property indicates the slider step size.
A value of 0 indicates that the value of the slider operates in a
continuous range between \l minimumValue and \l maximumValue.
Any non 0 value indicates a discrete stepSize. The following example
will generate a slider with integer values in the range [0-5]
\code
Slider {
maximumValue: 5.0
stepSize: 1.0
}
\endcode
The default value is \code 0
*/
property alias stepSize: range.stepSize property alias stepSize: range.stepSize
property alias hoverEnabled: mouseArea.hoverEnabled
/*!
\qmlproperty double Slider::value
This property holds the current value of the Slider
The default value is \code 0.0
*/
property alias value: range.value property alias value: range.value
// Destop API /*! \internal */
property bool containsMouse: mouseArea.containsMouse property bool containsMouse: mouseArea.containsMouse
/*!
\qmlproperty bool Slider::activeFocusOnPress
This property indicates if the Slider should receive active focus when
pressed.
*/
property bool activeFocusOnPress: false property bool activeFocusOnPress: false
/*!
\qmlproperty bool Slider::tickmarksEnabled
This property indicates if the Slider should display tickmarks
at step intervals.
The default value is \code false
*/
property bool tickmarksEnabled: false property bool tickmarksEnabled: false
/* \internal*/
property string tickPosition: "Below" // "Above", "Below", "BothSides" property string tickPosition: "Below" // "Above", "Below", "BothSides"
Accessible.role: Accessible.Slider Accessible.role: Accessible.Slider
Accessible.name: value Accessible.name: value
// Reimplement this function to control how the value is shown in the /*!
// indicator. \qmlmethod Slider::formatValue
This method returns the current slider value in a way that is more suitable
for user display, such as the \l value rounded to only two decimal places.
By default this function returns the nearest \code int value.
*/
function formatValue(v) { function formatValue(v) {
return Math.round(v); return Math.round(v);
} }
/* \internal */
property var styleHints:[] property var styleHints:[]
/* \internal */
property Component style: Qt.createComponent(Settings.THEME_PATH + "/SliderStyle.qml", slider) property Component style: Qt.createComponent(Settings.THEME_PATH + "/SliderStyle.qml", slider)
Keys.onRightPressed: value += (maximumValue - minimumValue)/10.0 Keys.onRightPressed: value += (maximumValue - minimumValue)/10.0
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment