From 3d55d182704e2c2b01aa3e5fc159507e322dd281 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 13 Mar 2019 09:50:14 +0100 Subject: Add BoundaryRule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ChangeLog][Qt Labs Animation] Added the BoundaryRule QML type, a PropertyValueInterceptor that restricts the range of values a numeric property can have, applies "resistance" when the value is overshooting, and provides the ability to animate it back within range. Change-Id: I677b407a351c12b0c5b23c34a45933154310c2cd Reviewed-by: Jan Arve Sæther --- .../quick/qquickboundaryrule/data/dragHandler.qml | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/auto/quick/qquickboundaryrule/data/dragHandler.qml (limited to 'tests/auto/quick/qquickboundaryrule/data/dragHandler.qml') diff --git a/tests/auto/quick/qquickboundaryrule/data/dragHandler.qml b/tests/auto/quick/qquickboundaryrule/data/dragHandler.qml new file mode 100644 index 0000000000..c66fd76ff1 --- /dev/null +++ b/tests/auto/quick/qquickboundaryrule/data/dragHandler.qml @@ -0,0 +1,23 @@ +import QtQuick 2.14 +import Qt.labs.animation 1.0 + +Rectangle { + id: root + width: 240; height: 120 + color: "green" + + DragHandler { + id: dragHandler + yAxis.minimum: -1000 + xAxis.minimum: -1000 + onActiveChanged: if (!active) xbr.returnToBounds(); + } + + BoundaryRule on x { + id: xbr + minimum: -50 + maximum: 100 + minimumOvershoot: 40 + maximumOvershoot: 40 + } +} -- cgit v1.2.3