aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quickcontrols/qquickpopup/data/destroyDuringExitTransition.qml
blob: dacffd3199becb4644fd0031a259302ad73f5981 (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
63
64
65
66
67
68
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick
import QtQuick.Controls

ApplicationWindow {
    id: window
    width: 400
    height: 400
    title: "destroyDuringExitTransition"

    property Dialog dialog1
    property Dialog dialog2

    Component {
        id: dlg

        Dialog {
            dim: true
            modal: true
            closePolicy: Popup.CloseOnEscape
            visible: true

            property alias button: button

            Column {
                Text {
                    text: "button is " + (button.down ? "down" : "up")
                }

                Button {
                    id: button
                    text: "Try to press this button"
                }
            }
        }
    }

    Component {
        id: brokenDlg
        Dialog {
            dim: true
            modal: true
            focus: true
            closePolicy: Popup.CloseOnEscape
            visible: true

            Text {
                text: "Press Esc key to reject this dialog"
            }

            exit: Transition {
                NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 100 }
            }
        }
    }


    Component.onCompleted: {
        dialog1 = dlg.createObject(window)
        dialog2 = brokenDlg.createObject(window)

        dialog2.onRejected.connect(function(){
            dialog2.destroy()
        })
    }
}