aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickdroparea/data/nested1.qml
blob: 430421d27b1823882b587298869bce2f97d93d7c (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
// Copyright (C) 2019 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0

Item {
    width: 200; height: 200
    property int outerEnterEvents: 0
    property int outerExitEvents: 0
    property int innerEnterEvents: 0
    property int innerExitEvents: 0

    DropArea {
        objectName: "outerDropArea"
        x: 75; y: 75
        width: 100; height: 100
        Rectangle {
            anchors.fill: parent
            color: "green"
        }
        onEntered: ++outerEnterEvents
        onExited: ++outerExitEvents

        DropArea {
            objectName: "innerDropArea"
            width: 50; height: 50
            Rectangle {
                anchors.fill: parent
                color: "blue"
            }
            onEntered: ++innerEnterEvents
            onExited: ++innerExitEvents
        }
    }

    Rectangle {
        width: 20; height: 20
        color: dragArea.pressed ? "red" : "brown"
        Drag.active: dragArea.drag.active
        MouseArea {
            id: dragArea
            objectName: "dragArea"
            anchors.fill: parent
            drag.target: parent
        }
    }
}