How to access 3 dimensional array from C++ to QML
Unsolved
QML and Qt Quick
-
Window {
visible: true
property var items :[[["blue", "green","yellow"],["red","black"]], [["black","grey"],["white","pink"]]]
property var subItems:[]
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}Row{ spacing:2 Repeater{ id: mainArr model: items Item{ width: 200 height: 150 Column{ spacing : 2 // anchors.horizontalCenter: parent.horizontalCenter height: parent.height Repeater{ model:items[index] Rectangle{ width: 200 height: 50 color: "blue" Row{ anchors.horizontalCenter: parent.horizontalCenter //width: 50 ; height: 50; //color: modelData Text{ text: modelData[0]} Text{ text: modelData[1]} Text{ text: modelData[2]} } } } } } } }
This is the sample Qml program , whereas I want to read this items array from QT C++.I tried with QList<QList<QVariant>>> datatype ,stored the values and returned in data() function as QVariant::fromValue(items).But I am not getting the values in qml instead just printing the datatype.