Unsolved sorting by multiple column in QSqlRelationalTableModel
-
Hi All,
basically i want achieve something similar to below sqlite command in "QSqlRelationalTableModel"
SELECT * FROM TABLE ORDER BY column1,column2 desc;
but the limitation of QSqlRelationalTableModel is that setsort() or sort() functions can sort by only one column.
How can i solve this issue? -
@divaindie
https://forum.qt.io/topic/23604/qsqltablemodel-sorting-by-multiple-columns/3andre
6 years ago
Sorting on multiple columns can, AFAIK, only be done using your own query, or using a custom subclass of QSortFilterProxyModel in which you reimplement bool lessThan(const QModelIndex& left, const QModelIndex& right) const.Also https://stackoverflow.com/questions/10893843/qsortfilterproxymodel-sort-multiple-columns