Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Is it possible to sort Data from QsqlTableModel

    General and Desktop
    2
    2
    670
    Loading More Posts
    • 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
      ashokb last edited by

      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 Reply Quote 0
      • C
        clochydd last edited by

        Hi, you should consider to use QSortFilterProxyModel

        1 Reply Last reply Reply Quote 0
        • First post
          Last post