Important: Please read the Qt Code of Conduct -

QSqlTableModel o QSqlQueryModel

  • hi all:
    My question is simple, with which class best fits and performs better, for example-Al sql query.
    A built-in row or column QcheckBox, ComboBox, QPushButton and others.
    And when there is a relationship between tables in a database.
    It is better or Create my StandardModel.
    What is the most profecial
    (QSqltableModel or QSqlQueryModel).

  • Which one fits best, depends on your use case. And you are telling us nothing about what you want to achieve.

  • The usual answer with that much information would be: It depends.

    In particular:

    • the number of columns
    • the number of rows
    • how the user is supposed to interact with the data

    and possibly many more points.

  • Hello
    If the forum I saw many problems using QSqlTableModel in queries, using setFilter () sql limiting, a comparison of the method QsqlQueryModel setQuery () solve this problem, but not well integrated QSqlQueryModel to sort data in QTableView sortingEnabled to order the sql query (producModel-> QSqlQueryModel :: setQuery (QString ("Select * From product where ( =% 1) limit 200"). arg (id)) ;) vanishes, well this is just some , what would be the best option

    Management System For Cars (desktop).
    -With a large amount of data (200000 users).
    -DB-Connection (Postgres).
    -Ease of use.

Log in to reply