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. Is it possible to sort Data from QsqlTableModel
QtWS25 Last Chance

Is it possible to sort Data from QsqlTableModel

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 779 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.
  • A Offline
    A Offline
    ashokb
    wrote on last edited by
    #1

    Hi,
    Is it possible to sort out and display data from QsqlTableModel as we do in actual sql query?
    Something like,
    SELECT DISTINCT modelName FROM joint_insp.modelinfo;
    So i want only model names from QsqlTableModel and display them.
    I want whole table in that QsqlTableModel so i can't do this,
    @model.setQuery("SELECT DISTINCT modelName FROM joint_insp.modelinfo");@

    because then there will be only modelNames in my QsqlTableModel. Write?
    So, is it possible or should i make specific query every time to database?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      clochydd
      wrote on last edited by
      #2

      Hi, you should consider to use QSortFilterProxyModel

      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