summaryrefslogtreecommitdiffstats
path: root/examples/declarative/connections/connections.qml
blob: 521cc0184ebb4950d11633cc3b3c40e5dd4c2a05 (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
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;
            
        }
    }
}