aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickmousearea/data/clickThrough2.qml
blob: 26241082256831b6ebfc859836292b7f9c0890f3 (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
import QtQuick 2.0

Item{
    width: 300
    height: 300
    property int doubleClicks: 0
    property int clicks: 0
    property int pressAndHolds: 0
    property int presses: 0
    property bool letThrough: false
    property bool noPropagation: false
    Rectangle{
        z: 0
        color: "lightsteelblue"
        width: 150
        height: 150
        MouseArea{
            anchors.fill: parent
            propagateComposedEvents: true
            onPressed: presses++
            onClicked: clicks++
            onPressAndHold: pressAndHolds++
            onDoubleClicked: doubleClicks++
        }
    }
    MouseArea{
        z: 1
        enabled: true
        anchors.fill: parent
        propagateComposedEvents: !noPropagation
        onClicked: mouse.accepted = !letThrough;
        onDoubleClicked: mouse.accepted = !letThrough;
        onPressAndHold: mouse.accepted = !letThrough;
    }
}