property variant a: {}
does not seem to work. a ends up being undefined, rather than an empty dictionary.
I'm not very experienced with Javascript ... what is the correct way to initialize a property to hold an empty dictionary?
The following qml prints "qrc:/main.qml:13: TypeError: Type error" on the console. However, if a is initialized to, say {"dummyentry": 42}, then
the expected results are logged.
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
ApplicationWindow {
visible: true; width: 600; height: 200
property variant a: {}
Component.onCompleted: {
console.log("initial a="+JSON.stringify(a)) // TypeError: Type error
a["newkey"] = 999 // gets "TypeError: Type error"
console.log("updated a="+JSON.stringify(a))
}
}