File: test-pathview-2.qml

package info (click to toggle)
qtquick1-opensource-src 5.3.2-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 50,652 kB
  • ctags: 15,945
  • sloc: cpp: 134,378; ansic: 192; xml: 189; sh: 96; php: 54; makefile: 19
file content (70 lines) | stat: -rw-r--r-- 2,141 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import QtQuick 1.0

Rectangle {
    width: 580; height: 220
    //Same as test-pathview, but with pathItemCount < model.count
    
    ListModel {
        id: rssModel
        ListElement { lColor: "red" }
        ListElement { lColor: "green" }
        ListElement { lColor: "yellow" }
        ListElement { lColor: "blue" }
        ListElement { lColor: "purple" }
        ListElement { lColor: "gray" }
        ListElement { lColor: "brown" }
        ListElement { lColor: "thistle" }
    }

    Component {
        id: photoDelegate
        Rectangle {
            id: wrapper
            width: 65; height: 65; color: lColor
            scale: wrapper.PathView.scale

            MouseArea { anchors.fill: parent }
            
            transform: Rotation {
                id: itemRotation; origin.x: wrapper.width/2; origin.y: wrapper.height/2
                axis.y: 1; axis.z: 0; angle: wrapper.PathView.angle
            }
        }
    }

    PathView {
        id: photoPathView; model: rssModel; delegate: photoDelegate
        anchors.fill: parent;  z: 1
        anchors.topMargin:40
        pathItemCount: 6
        path: Path {
            startX: -50; startY: 40;
            
            PathAttribute { name: "scale"; value: 0.5 }
            PathAttribute { name: "angle"; value: -45 }
            
            PathCubic {
                x: 300; y: 140
                control1X: 90; control1Y: 30
                control2X: 140; control2Y: 150
            }
            
            PathAttribute { name: "scale"; value: 1.2  }
            PathAttribute { name: "angle"; value: 0 }
            
            PathCubic {
                x: 600; y: 30
                control2X: 440; control2Y: 30
                control1X: 420; control1Y: 150
            }
            
            PathAttribute { name: "scale"; value: 0.5 }
            PathAttribute { name: "angle"; value: 45 }
        }
    }

    Column {
        Rectangle { width: 20; height: 20; color: "red"; opacity: photoPathView.moving ? 1 : 0 }
        Rectangle { width: 20; height: 20; color: "blue"; opacity: photoPathView.flicking ? 1 : 0 }
    }
}