Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. sorting by multiple column in QSqlRelationalTableModel

sorting by multiple column in QSqlRelationalTableModel

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 755 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    divaindie
    wrote on last edited by
    #1

    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?

    JonBJ 1 Reply Last reply
    0
    • D divaindie

      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?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @divaindie
      https://forum.qt.io/topic/23604/qsqltablemodel-sorting-by-multiple-columns/3

      andre
      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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved