@mirro said in Why is this 'keyValueList.push(KeyValue{})' code syntax incorrect in qml?:
But I don't understand why you can't just assign values but use temporary variables instead?
you can, but be aware of
https://doc.qt.io/qt-5/qml-variant.html#storing-arrays-and-objects
Additionally, since items and attributes are not QML objects, changing the values they contain does not trigger property change notifications. If the above example had onItemsChanged or onAttributesChanged signal handlers, they would not be called when assigning individual entries in either property. If, however, the items or attributes properties themselves were reassigned to different values, then such handlers would be called.
@mirro said in Why is this 'keyValueList.push(KeyValue{})' code syntax incorrect in qml?:
Also, do I need to free memory in this 'Component.onDestruction'?
AFAIK no, because there is automatic garbage collection