mirror of
https://github.com/qmlnet/qmlnet.git
synced 2026-05-21 14:55:34 -06:00
This is the failure scenario.
This commit is contained in:
parent
6fa14724c8
commit
df55652c18
2 changed files with 16 additions and 11 deletions
|
|
@ -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()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue