I have a some code like follows, when i click on a list item in the view, there is a runtime error with model[index], i cant figure out why, in qt creator index is also highlighted blue & italicized like javascript:
somemodelpage.qml
page{
listview {
id: itemview
delegate: itemdelegate { }
model: cppmodel
function delegateClicked(index) {
model.folder = model[index].name;
}
}
page{
listview {
id: itemview
delegate: itemdelegate { }
model: cppmodel
function delegateClicked(index) {
model.folder = model[index].name;
}
}
To copy to clipboard, switch view to plain text mode
itemdelegate.qml
Item {
id: root
...
mousearea {
onclicked: root.ListView.view.delegateClicked(index)
}
Item {
id: root
...
mousearea {
onclicked: root.ListView.view.delegateClicked(index)
}
To copy to clipboard, switch view to plain text mode
Bookmarks