Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

How to remove a specific row from QML table

$
0
0
Hi, I am working with QML Tableview, I have created a model to fill data in the rows of QML Table. I am able to fill data succesfull in the table row when i press the “New row data” button, i am also able to remove the rows from the table using “Delete the row” tool button. Now i am facing following problems: I want to select the row which will be deleted by “delete the row” button, by using up and down buttons. So please tell me how i can select a table row entry using up and down tool button and how i can get the index of the selected row, so by pressing delete button i can delete that particular selected row from the table. ToolButton {   iconSource: "../createrow.png"                    Accessible.name: "New row data"                     onClicked: {                      firstmodel.append({data1: "star", data2:"LASTNAME",data3:"NAME"})                                              }                     tooltip: "create a new row" }                   ToolButton { Accessible.name: "up"  iconSource: "../images/up.png"                     onClicked: window1.visible = !window1.visible                     Accessible.name: "Go_upside in the table rows"                     tooltip: "go up" }                   ToolButton { Accessible.name: "down"                     iconSource: "../Down.png"                     tooltip: Go_downside in the table rows." }                  ToolButton { Accessible.name: "Delete the Row"                    iconSource: "../delete.png"                     tooltip: "go down."tooltip: "Delete the row"                    onClicked: {                     firstmodel.remove(ListView.currentIndex)                        console.log(tablemodel.currentIndex)                       }                     }

Viewing all articles
Browse latest Browse all 4972

Trending Articles