Remove row from QSqlTableModel
-
Hi, I have created a QSqlTableModel with edit strategy is onManualSubmit. Now i want to delete a row from the table. deleted row is not completely removed until i submit the changes. Is there is a any way to remove row instantly from the model but not from the database?
-
Hi,
Something's not clear, why do you want to remove the row only from the model and not from the database ?
-
Hi. I want it remove from database if I submit the changes. But now it doesn't remove from the tableview. It shows marked as remove. I want to remove row instantly when removeRow() is executed and only remove row from the database i clicked the submit.
-
You may want to look into the QSortFilterProxyModel class. It is able to filter out any records you like based on criteria you specify. They remain in the source model but aren't displayed by your view.
-
Is there a way to filter rows marked as deleted? i couldn't find a way.
-
Since you know the row you want to delete you could use setRowHidden for that.
-
Sorry for the late reply. Hidden row is not working because i want to remove row when user click over that row. I did is using TableView's on_table_clicked slot. if i hidden row from model tableView's index and model's index are not going to match. Is there any other solution?
1/7