Is it possible to sort Data from QsqlTableModel

  • 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?

  • Hi, you should consider to use QSortFilterProxyModel

Log in to reply