aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests/QtQml/bug_847.qml
blob: 18efd80ce4ac7618a8ed4fdec50129ebb0190116 (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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

import QtQuick 2.0

Rectangle {
    width: 500
    height: 500
    color: 'red'

    property variant pythonObject: undefined

    Text {
        anchors.centerIn: parent
        text: 'click me'
        color: 'white'
    }

    onPythonObjectChanged: {
        if (pythonObject) {
            // Delay execution of method invocation, so that the event loop has a chance to start,
            // which will subsequently be stopped by the method.
            timer.start()
        }
    }

    Timer {
        id: timer
        interval: 100; running: false;
        onTriggered: {
            if (pythonObject) {
                pythonObject.blubb(42, 84)
            }
        }
    }
}