Access item inside ListView via delegate
Solved
QML and Qt Quick
-
@J-Hilk
Now when I tried with empty textListModel { id: listModel ListElement { editableText: "" } }
and then I tried to change the text field value manually say "sometext" . Button event returned null
onClicked: { listModel.get(0).editableText console.log(listModel.get(0).editableText ) //Null }
while button event setting property gave proper result
onClicked: { listModel.setProperty(index, "editableText ", id.text) console.log(listModel.get(0).editableText ) //"sometext" }
-
@Ratzz said in Access item inside ListView via delegate:
listModel.get(0).editableText
What is that line supposed to do? You are not modifying anything here
onClicked: { listModel.setProperty(index, "editableText ", textEdit.text) }
just do that instead:
onClicked: editableText = textEdit.text