How to push values to QML property variant two dimensional array - dynamically?
问题 This is what I have tried: import QtQuick 2.0 Rectangle { property variant twoDimTempArray: [[]] property variant oneDArray: [1,2,3] MouseArea { anchors.fill: parent onClicked: { twoDimTempArray.push (oneDArray) twoDimTempArray[0].push (oneDArray) twoDimTempArray[0][0] = oneDArray[0] console.log (twoDimTempArray) } } } They all results in [] . How to push values in QML property variant two dimensional array? 回答1: One way to add the values dynamically to a 1 dimensional QML variant is to fill