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. QSqlTableModel and QTableView edit cell of a database query

QSqlTableModel and QTableView edit cell of a database query

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 851 Views 2 Watching
  • 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.
  • Andy314A Offline
    Andy314A Offline
    Andy314
    wrote on last edited by Andy314
    #1

    Hello,
    I need a lot of database editable grids in my GUI. In Qt its seem very complicated compared to Microsoft Access. (Access is not a really an option of course.)
    In Access I can edit cells in a TableView of a query without an further work.
    I found that it works in a QSqlTableModel only with simple querys which are 1:1 relation to a table. select * from table -> define qrytable in a DB.

    But when make a bit more complicated query and join some an other Tables, the editing seen work first - the cell takes the new value - but the are not really stored in the database.

    I there an easy way to edit values of a query in a QTableView ?

    kshegunovK 1 Reply Last reply
    0
    • Andy314A Andy314

      Hello,
      I need a lot of database editable grids in my GUI. In Qt its seem very complicated compared to Microsoft Access. (Access is not a really an option of course.)
      In Access I can edit cells in a TableView of a query without an further work.
      I found that it works in a QSqlTableModel only with simple querys which are 1:1 relation to a table. select * from table -> define qrytable in a DB.

      But when make a bit more complicated query and join some an other Tables, the editing seen work first - the cell takes the new value - but the are not really stored in the database.

      I there an easy way to edit values of a query in a QTableView ?

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      @Andy314
      You may want to try QSqlRelationTableModel instead.

      In Qt its seem very complicated compared to Microsoft Access.

      Sure, Qt is a library for one of the most complex programming languages out there, while Access is made to be used as an Office supplement. Complexity scales about the same as flexibility and performance, so I suppose it's fair to say Qt (and C++ by extension) is somewhat complicated.

      Read and abide by the Qt Code of Conduct

      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