I want to remove multiple rows which are selected in the QTableWidget . can anyone have any ideas ?
You can remove multiple items at once, The tips, is begin delete the rows from the bottom. i'm sorry im not a VS2008 developer, but this solution can be easy convert to VS2008 code. Here the Python code. Sorry for the late response :)
# Delete the selected mytable lines
deleteRows(self.mytable.selectionModel().selectedRows())
# DeleteRows function
def deleteRows(self, rows):
# Get all row index
indexes = []
for row in rows:
indexes.append(row.row())
# Reverse sort rows indexes
indexes = sorted(indexes, reverse=True)
# Delete rows
for rowidx in indexes:
self.mytable.removeRow(rowidx)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With