[Solved] How to de-select multiple cells in QTableWidget?
-
Hi,
For certain situation I have to manually select cells/column/row by code in my QTableWidget.
Now the problem is that I cannot find any method like QTableWidget::clearSelection() which will deselect all selected cells. Currently the following happens:- mySelectionFunction();//selects a row/column
- again call mySelectionFunction() for some other row/column; //previous row/column as well as current row/column are selected
What I want is :
- mySelectionFunction();//selects a row/column
- myTable->clearSelection(); //clears all selected cells in QTableWidget
- again call mySelectionFunction() for some other row/column; //only current row/column is selected
Any help in how to do step no. 2?
Thanks! -
Hi,
Something like "this":http://qt-project.org/doc/qt-4.8/qitemselectionmodel.html#clear ?
-
Hi SGaist,
Thanks a lot man!
Works like a charm...Used this:
QTableWidget->selectionModel()->clearSelection();