aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/data/scriptConnectSingleton.qml
blob: f666945b3300748cdea03b207bfe9bf742897c3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import QtQuick
import Test

Item {
    id: root

    property int a: 0
    signal mySignal

    function test() {
        MyInheritedQmlObjectSingleton.value++
        root.a = MyInheritedQmlObjectSingleton.value
    }

    function disconnectSingleton() {
        root.mySignal.disconnect(MyInheritedQmlObjectSingleton, root.test)
    }

    Component.onCompleted: root.mySignal.connect(MyInheritedQmlObjectSingleton,
                                                 root.test)
}