I'm trying to create a new javascript object in QML.
In javascript I would simply:
var newObject = new Object();
but this is flagged as an error by QtCreator
Can anyone help?
You don't need new
. You can just create an empty JS Object like this in a script part (e.g. signal handler, function etc.)
var newObject = {} // In a script.
or as a property:
property var someObject: ({}) // You need to wrap it in paranthesis
If you insist on the new
-keyword
var someOtherObject = new Object // In a script
seems to be working, too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With