QTableWidget vs QTableView and setSortRole
I need to sort a table by different values that are displayed in the cells.
The QTableView model has wonderful option to do it.
Code:
model->setSortRole(Qt::UserRole);
But I do use QTableWidget and don't want to switch to TableView.
What I can use to get it working in TableWidget instead ??
Thanks
Re: QTableWidget vs QTableView and setSortRole
setSortRole() is a method of QStandardItemModel, not of any of the table view classes.
ALso, since QTableWidget is derived from QTableView, QTableWidget IS a QTableView, and you wouldn't need to switch between classes.