QTableWidget How to Deselect Row
-
Hello
I have a QTableWidget on my form. I have two buttons, one to perform selection and the other button to perform deselection.
For selection i use the following code:
ui.tableWidget->selectRow(0);so first row will be selected on my QTableWidget.
But how do i go about deselecting the row when the other button is pressed? I have tried the following but it did not work.
ui.tableWidget->selectionModel()->clearSelection();Please advise. Thank you.
-
Hello
I have a QTableWidget on my form. I have two buttons, one to perform selection and the other button to perform deselection.
For selection i use the following code:
ui.tableWidget->selectRow(0);so first row will be selected on my QTableWidget.
But how do i go about deselecting the row when the other button is pressed? I have tried the following but it did not work.
ui.tableWidget->selectionModel()->clearSelection();Please advise. Thank you.
@qt-1234
ui.tableWidget->clearSelection();(inherited from https://doc.qt.io/qt-5/qabstractitemview.html#clearSelection)?
-
@qt-1234
ui.tableWidget->clearSelection();(inherited from https://doc.qt.io/qt-5/qabstractitemview.html#clearSelection)?