Unsolved How to remove ListModel row in TableView qml
-
Hi ,
I have TableView in application .How to remove ListModel currentRow in TableView in qml.When I remove curent index of TableView gives an exeption like below.listModel.remove(componentTableView.currentRow);
Console Output:
QML ListModel: set: index -1 out of range
Thanks
-
Hi,
-1 means that there's no row selected. You should add a check about it before calling remove
-
Hi,
I have added select previous row code like below but again console output gives exception.
componentTableView.selection.select(componentTableView.currentRow-1);
listModel.remove(componentTableView.currentRow);Console Output:
QML ListModel: set: index -1 out of rangeHow can I add a check about it before calling remove in qml code ?
Thanks,
-
Use an if to check wether currentRow is under 0
-
Hi ,
Can you write code because I unresolved the problem when I use an if to check wether currentRow is under 0
Thanks
-
Can you show your actual code ?