From df55652c189bccd24da4936aefbf4e8bf3f9e6e6 Mon Sep 17 00:00:00 2001 From: Paul Knopf Date: Wed, 18 Jul 2018 23:23:33 -0400 Subject: [PATCH] This is the failure scenario. --- src/net/Qt.NetCore.Sandbox/Program.UI.cs | 12 ++++++++++-- src/net/Qt.NetCore.Sandbox/main.qml | 15 ++++++--------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/net/Qt.NetCore.Sandbox/Program.UI.cs b/src/net/Qt.NetCore.Sandbox/Program.UI.cs index 23d8c7d4..2ab7413e 100644 --- a/src/net/Qt.NetCore.Sandbox/Program.UI.cs +++ b/src/net/Qt.NetCore.Sandbox/Program.UI.cs @@ -12,11 +12,19 @@ namespace Qt.NetCore.Sandbox [Signal("testSignal", NetVariantType.String)] public class TestQmlImport { - public void TestMethod() + readonly AnotherType _anotherType = new AnotherType(); + + public AnotherType GetSharedInstance() { - Console.WriteLine("Invoked method!"); + return _anotherType; } } + + [Signal("testSignal", NetVariantType.String)] + public class AnotherType + { + + } static int Main() { diff --git a/src/net/Qt.NetCore.Sandbox/main.qml b/src/net/Qt.NetCore.Sandbox/main.qml index 7b71fa81..01e9fe76 100644 --- a/src/net/Qt.NetCore.Sandbox/main.qml +++ b/src/net/Qt.NetCore.Sandbox/main.qml @@ -8,24 +8,21 @@ ApplicationWindow { width: 640 height: 480 title: qsTr("Hello World") - Item { Timer { interval: 1000; running: true; repeat: true onTriggered: { - test.testSignal("test") - test.TestMethod() + var o = test.GetSharedInstance() + o.testSignal.connect(function(message) { + console.log("Signal was raised: " + message) + }) + var o2 = test.GetSharedInstance() + o2.testSignal("Hello") } } } TestQmlImport { id: test - Component.onCompleted : { - testSignal.connect(function(o) { - console.log("Signal raised: " + o) - }) - console.log("Connected signal") - } } }