summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qmlvisual/qdeclarativemousearea/nested.qml
blob: b2d88d2ca9e283d667e3c0ff6b96c4567ff6c490 (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
import QtQuick 1.0

/*
  Test nested MouseArea with different drag axes.
*/

Rectangle{
    width:400
    height:360
    color: "white"
    Flickable {
        anchors.fill: parent
        contentWidth: 600
        contentHeight: 600
        Rectangle{
            id: draggable
            width:200; height:200; color: "lightsteelblue"
            opacity: ma1.drag.active ? 0.5 : 1.0
            y:20
            MouseArea{
                id: ma1
                objectName: "one"
                anchors.fill: parent
                drag.target: draggable
                drag.axis: "XandYAxis"
                drag.filterChildren: true
                drag.minimumX: 0
                drag.maximumX: 200
                drag.minimumY: 20
                drag.maximumY: 220
                Rectangle{
                    id: draggable_inner
                    width:40; height:40; color: "red"
                        y:20
                    MouseArea{
                        objectName: "two"
                        anchors.fill: parent
                        drag.target: draggable_inner
                        drag.axis: "XAxis"
                        drag.minimumX: 0
                        drag.maximumX: 360
                    }
                }
            }
        }
        Rectangle{
            id: draggable3
            width:40; height:40; color: "green"
            opacity: ma3.drag.active ? 0.5 : 1.0
            y:210
            MouseArea{
                id: ma3
                objectName: "three"
                anchors.fill: parent
                drag.target: draggable3
                drag.axis: "XAxis"
                drag.minimumX: 0
                drag.maximumX: 360
            }
        }
    }
}