GridView data
Solved
QML and Qt Quick
-
This is probably QML 101, but I'm having difficulties figuring out how to iterate through or even get values from a GridView. I have a 7x3 GridView made up of delegate I made:
import QtQuick 2.0 Item{ id: scheduleDelegate property string name signal trigger(string name) Column{ spacing: 5 Text{ id: columnHeading width: 35 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter text: "Wk " + (index + 1) } TextEditNumberInput{ id: bloom textToShow: text1 } } TextEditNumberInput{ id: big textToShow: text2 } } TextEditNumberInput{ id: tiger textToShow: text3 } } } }
TextEditNumberInput is as follows:
import QtQuick 2.0 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.3 TextField{ id: number property alias textToShow: number.text width: 35 height: 35 Layout.fillHeight: true Layout.fillWidth: true horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter padding: 0 text: text background: Rectangle { border.color: "#D3D3D3" border.width: 1 anchors.fill: parent } NumberPad{ id: numberPad } MouseArea { anchors.fill: parent onClicked: { numberPad.x = (width / 5 - numberPad.width / 5 ) numberPad.y = (height / 2 - numberPad.height / 2) var numberPadComponent = Qt.createComponent("qrc:/pages/NumberPad.qml"); if (numberPadComponent.status === Component.Ready) { var dialog = numberPadComponent.createObject(parent); numberPad.open() } } } Connections { id: numberPadConnection target: numberPad onVisibleChanged: { if(!target.visible){ if(!target.returnValue==""){ setNumberOfWeeksText(); } } } function setNumberOfWeeksText(){ number.text = target.returnValue; } } }
Can someone help explain to me how to get the values from the TextField within my GridView?