aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-11-28 10:57:45 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2016-12-14 19:46:05 +0000
commitd49ab00f2b9c99da48d9ddef2b0627a86d54b95e (patch)
treedde0f77d4353f3cc6adfef085ba19ab78ac7bc57 /src/imports
parentbc6414762e48f12f6680ee6bb667c49c64fbd32a (diff)
SwipeDelegate: transition swipe.position
Previously the value of swipe.position jumped on mouse/touch release, or when open() or close() was called. Transitioning the swipe.position value smoothly to the target value makes it possible to use it as opacity/scale/etc. for the side items. Notice that this is backwards compatible with the old behavior. If no transition is set, the value jumps the same way it did before. In that case, Behavior on x makes the movement smooth. Task-number: QTBUG-57242 Change-Id: Id9c06b5b08fa73f2f575787e16dc6e20e4ccb545 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/controls/SwipeDelegate.qml18
-rw-r--r--src/imports/controls/material/SwipeDelegate.qml18
-rw-r--r--src/imports/controls/universal/SwipeDelegate.qml18
3 files changed, 6 insertions, 48 deletions
diff --git a/src/imports/controls/SwipeDelegate.qml b/src/imports/controls/SwipeDelegate.qml
index 099ee117..1c900b52 100644
--- a/src/imports/controls/SwipeDelegate.qml
+++ b/src/imports/controls/SwipeDelegate.qml
@@ -52,6 +52,8 @@ T.SwipeDelegate {
padding: 12
spacing: 12
+ swipe.rebound: Transition { SmoothedAnimation { velocity: 3; easing.type: Easing.InOutCubic } }
+
contentItem: Text {
leftPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
rightPadding: !control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
@@ -63,27 +65,11 @@ T.SwipeDelegate {
visible: control.text
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
-
- Behavior on x {
- enabled: !control.down
- NumberAnimation {
- easing.type: Easing.InOutCubic
- duration: 400
- }
- }
}
background: Rectangle {
color: control.visualFocus
? (control.down ? Default.focusPressedColor : Default.delegateFocusColor)
: (control.down ? Default.delegatePressedColor : Default.backgroundColor)
-
- Behavior on x {
- enabled: !control.down
- NumberAnimation {
- easing.type: Easing.InOutCubic
- duration: 400
- }
- }
}
}
diff --git a/src/imports/controls/material/SwipeDelegate.qml b/src/imports/controls/material/SwipeDelegate.qml
index c6240910..4247ddf1 100644
--- a/src/imports/controls/material/SwipeDelegate.qml
+++ b/src/imports/controls/material/SwipeDelegate.qml
@@ -54,6 +54,8 @@ T.SwipeDelegate {
bottomPadding: 8
spacing: 16
+ swipe.rebound: Transition { SmoothedAnimation { velocity: 3; easing.type: Easing.InOutCubic } }
+
contentItem: Text {
leftPadding: !control.mirrored ? (control.indicator ? control.indicator.width + control.spacing : 0) : 0
rightPadding: control.mirrored ? (control.indicator ? control.indicator.width + control.spacing : 0) : 0
@@ -65,14 +67,6 @@ T.SwipeDelegate {
visible: control.text
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
-
- Behavior on x {
- enabled: !control.down
- NumberAnimation {
- easing.type: Easing.InOutCubic
- duration: 400
- }
- }
}
background: Rectangle {
@@ -98,13 +92,5 @@ T.SwipeDelegate {
color: control.Material.rippleColor
enabled: control.swipe.position === 0
}
-
- Behavior on x {
- enabled: !control.down
- NumberAnimation {
- easing.type: Easing.InOutCubic
- duration: 400
- }
- }
}
}
diff --git a/src/imports/controls/universal/SwipeDelegate.qml b/src/imports/controls/universal/SwipeDelegate.qml
index 0b888e70..193d1ab1 100644
--- a/src/imports/controls/universal/SwipeDelegate.qml
+++ b/src/imports/controls/universal/SwipeDelegate.qml
@@ -54,6 +54,8 @@ T.SwipeDelegate {
topPadding: padding - 1
bottomPadding: padding + 1
+ swipe.rebound: Transition { SmoothedAnimation { velocity: 3; easing.type: Easing.InOutCubic } }
+
contentItem: Text {
leftPadding: !control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
rightPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
@@ -68,14 +70,6 @@ T.SwipeDelegate {
opacity: enabled ? 1.0 : 0.2
color: control.Universal.foreground
-
- Behavior on x {
- enabled: !control.down
- NumberAnimation {
- easing.type: Easing.InOutCubic
- duration: 400
- }
- }
}
background: Rectangle {
@@ -94,13 +88,5 @@ T.SwipeDelegate {
opacity: control.Universal.theme === Universal.Light ? 0.4 : 0.6
}
}
-
- Behavior on x {
- enabled: !control.down
- NumberAnimation {
- easing.type: Easing.InOutCubic
- duration: 400
- }
- }
}
}