diff options
author | Ulf Hermann <[email protected]> | 2019-09-17 18:10:59 +0200 |
---|---|---|
committer | Ulf Hermann <[email protected]> | 2020-02-11 19:26:05 +0100 |
commit | 90b4528b846542bfa6f0723487315140b9de17b4 (patch) | |
tree | 9356c0e6b5a736b3228ca6793416d927432c101e /examples/quick/quick-accessibility | |
parent | 38c03709236f6a2114ace7adf1b6bdcdfe8e4e18 (diff) |
Avoid discouraged patterns in examples
In particular, use required properties where applicable, explicitly
import QtQml where we use it, avoid unqualified access into the root
scope of a component, use JavaScript functions with explicit parameters
as signal handlers.
Change-Id: I3eaaba47cc3c7a2a12d488e36f9eec145cedbb0e
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Shawn Rutledge <[email protected]>
Diffstat (limited to 'examples/quick/quick-accessibility')
-rw-r--r-- | examples/quick/quick-accessibility/content/Slider.qml | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/quick/quick-accessibility/content/Slider.qml b/examples/quick/quick-accessibility/content/Slider.qml index aa425797a7..241e5d804e 100644 --- a/examples/quick/quick-accessibility/content/Slider.qml +++ b/examples/quick/quick-accessibility/content/Slider.qml @@ -72,7 +72,7 @@ Rectangle { x: 1 y: 1 height: parent.height - 2 - width: ((parent.width - 2) / maximumValue) * value + width: ((parent.width - 2) / slider.maximumValue) * slider.value color: "lightgrey" Behavior on width { NumberAnimation { duration: 50 } @@ -88,8 +88,9 @@ Rectangle { MouseArea { anchors.fill: parent - onClicked: { - var pos = mouse.x / slider.width * (maximumValue - minimumValue) + minimumValue + onClicked: (mouse) => { + var pos = mouse.x / slider.width * (slider.maximumValue - slider.minimumValue) + + slider.minimumValue slider.value = pos } } |