Unsolved how to filter listmodel elements by text without deleting and remaking items?
-
hi, i used below code to search in listview and search does work fine
but problem is that i don't want to clear list model and make it again
this made a big problem for meCODE:
function searchInListModel(filter) // my function { rigt_lisModl.clear() // this is bad for(var i = 0; i < root.crtItems.get("chartItem").length; i++) // adding again all items by text { if(root.crtItems.get("chartItem")[i][0].toLocaleLowerCase().search(filter.toLocaleLowerCase()) >= 0) // filtering { rigt_lisModl.append( // add filtered item { topTxt: root.crtItems.get("chartItem")[i][0], centerTxt: root.crtItems.get("chartItem")[i][1], clickedBorder: 0 }) } } } onTextChanged: { searchInListModel(text) }
i'm grateful for any help
-
https://doc.qt.io/archives/qt-5.9/qtquick-tutorials-dynamicview-dynamicview4-example.html
I kind of wish I saw this earlier when doing some of this work. I ended up using some C++ models to do this.