Dekko
Loading...
Searching...
No Matches
StackSlideDelegate.qml
1import QtQuick 2.4
2
3StackViewDelegate {
4 id: root
5
6 property bool horizontal: true
7
8 function getTransition(properties)
9 {
10 return root[horizontal ? "horizontalSlide" : "verticalSlide"][properties.name]
11 }
12
13 function transitionFinished(properties)
14 {
15 properties.exitItem.x = 0
16 properties.exitItem.y = 0
17 }
18
19 property QtObject horizontalSlide: QtObject {
20 property Component pushTransition: StackViewTransition {
21 PropertyAnimation {
22 target: enterItem
23 property: "x"
24 from: target.width
25 to: 0
26 duration: 250
27 easing.type: Easing.OutCubic
28 }
29 PropertyAnimation {
30 target: exitItem
31 property: "x"
32 from: 0
33 to: -target.width
34 duration: 250
35 easing.type: Easing.OutCubic
36 }
37 }
38
39 property Component popTransition: StackViewTransition {
40 PropertyAnimation {
41 target: enterItem
42 property: "x"
43 from: -target.width
44 to: 0
45 duration: 250
46 easing.type: Easing.OutCubic
47 }
48 PropertyAnimation {
49 target: exitItem
50 property: "x"
51 from: 0
52 to: target.width
53 duration: 250
54 easing.type: Easing.OutCubic
55 }
56 }
57 property Component replaceTransition: pushTransition
58 }
59
60 property QtObject verticalSlide: QtObject {
61 property Component pushTransition: StackViewTransition {
62 PropertyAnimation {
63 target: enterItem
64 property: "y"
65 from: target.height
66 to: 0
67 duration: 300
68 }
69 PropertyAnimation {
70 target: exitItem
71 property: "y"
72 from: 0
73 to: -target.height
74 duration: 300
75 }
76 }
77
78 property Component popTransition: StackViewTransition {
79 PropertyAnimation {
80 target: enterItem
81 property: "y"
82 from: -target.height
83 to: 0
84 duration: 300
85 }
86 PropertyAnimation {
87 target: exitItem
88 property: "y"
89 from: 0
90 to: target.height
91 duration: 300
92 }
93 property Component replaceTransition: pushTransition
94 }
95 }
96}
97