summaryrefslogtreecommitdiffstats
path: root/examples/declarative/connections/connections.qml
blob: b693b7e0c5bd9fa33976345d739ca118a718200c (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
import Qt 4.6

Rectangle {
    id: rect
    color: "blue"
    width: 40
    height: 30

    Rectangle {
        id: dot
        color: "red"
        width: 3
        height: 3
        x: rect.width/2
        y: rect.height/2
    }

    MouseRegion {
        id: mr
        anchors.fill: rect
    }

    Connection {
        sender: mr
        signal: "clicked(mouse)"
        script: { 
            color = "green";
            dot.x = mouse.x-1;
            dot.y = mouse.y-1;
        }
    }
}