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
|
import QtQml 2.15
QtObject {
id: root
Component.onCompleted: {
function WithPrototype(refMsgSeqNr) {
this.init(refMsgSeqNr)
};
WithPrototype.prototype = {
init: function(refMsgSeqNr) {
this.testObj = {
has: function(a) { return a === refMsgSeqNr }
}
this.protocolSubTypeID = 2
this.messageControl = 0
this.referredMsgSequenceNumber = refMsgSeqNr
}
};
let comp = Qt.createComponent("dynamic.qml");
let inst1 = comp.createObject(root, { testObj: new Set(), });
let inst2 = comp.createObject(root, new WithPrototype(1));
objectName = inst1.use() + " - " + inst2.use();
}
}
|