I've found an issue tonight and I wonder if this is a mistake between the keyboard and the screen or a QML/javascript integration problem.
Here is my example:
var myHash = {}
for (var i=0; i<3; ++i) {
var newObject = Qt.createQmlObject('import QtQuick 2.3; Rectangle {color: "red"; width: 20; height: 40}', main, "test")
console.log(newObject.color)
myHash[newObject] = i
}
for (var key in myHash) {
console.log("Object type:" + key)
console.log("Color: " + key.color)
}
The output is:
qml: Initial color: #ff0000
qml: Initial color: #ff0000
qml: Initial color: #ff0000
qml: Object type:QQuickRectangle(0x98e9ac8)
qml: Color: undefined
qml: Object type:QQuickRectangle(0x98da7a0)
qml: Color: undefined
qml: Object type:QQuickRectangle(0x970b328)
qml: Color: undefined
Thus, when I've stored my QML object in the hash-map myHash
as a key, QML has kept the object type, but forgot the properties?