summaryrefslogtreecommitdiffstats
path: root/CoffeeTweed/Tray.qml
blob: 608317a2d55a61c4d3cf40b3a95702e20790ca9f (plain)
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
import Qt 4.7

Item {
    id:cuptray
    width: 330; height: 110;

    Tray_model{
        id: traymodel
    }

    function add_cup(indx) {
        var cupindx = indx -1;
        traymodel.set(cupindx, { cupstate: "display" });
    }

    function remove_cup(indx) {
        var cupindx = indx;
        traymodel.set(cupindx, { cupstate: "hide" });
    }

    Component {
        id: emptycup
        Item {
            id: empty_cup
            width: 69; height: 67
            x: pos_x; y: pos_y; z: pos_z
            opacity: 0
            state: cupstate

            Image { source: img_src }

            Behavior on opacity { NumberAnimation { duration: 400 } }

            states: [
                State {
                    name: "display"
                },
                State {
                    name: "hide"
                }
            ]
            transitions: [
                Transition {
                    from: "*"; to: "hide"
                    SequentialAnimation {
                        PropertyAnimation { target: empty_cup; property: "opacity"; to: 0; }
                    }
                },
                Transition {
                    from: "hide"; to: "display"
                    SequentialAnimation {
                        PropertyAnimation { target: empty_cup; property: "opacity"; to: 1; }
                    }
                }
            ]
        }
    }

    Repeater {
       model: traymodel
       delegate: emptycup
    }

}