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. Correct way to proxy SQLite tables
Forum Updated to NodeBB v4.3 + New Features

Correct way to proxy SQLite tables

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 1 Posters 157 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.
  • S Offline
    S Offline
    SergeyK12
    wrote on 15 Oct 2024, 20:03 last edited by SergeyK12
    #1

    Hi.
    I wonder what is correct way to proxy QSqlTableModel to use with QTreeView with editing possability.
    Suppose i have two tables:
    first one store root tag (id is PRIMARY KEY)

    | id |  tag   |
    ---------------
    |  1 | common |
    |  2 | math   |
    

    second one store child names (id is FOREIGN KEY)

    | id |  name |
    ---------------
    |  1 | subst |
    |  1 | conc  |
    |  2 | sin   |
    

    Which should be represented as tree:

    -common
      |-substr
      |-conc 
    -math
      |-sin
    

    Should i crete QSqlTableModel for both models and manage them in proxy?
    Or use proxy to collect data from both models in easier format:

    |   0    |   1    |  2   |
    | common | subdts | conc |
    | math   | sin    | x    |
    

    and then use proxy which take 0 colum as a root and all other columns as a child.

    Or its possible to interact with database (ofcourse its possible) within proxy to get specific info trough FOREIGN KEY info (but where to get mapFromSource indexes to handle insert or modify)

    Thanks for any advise.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SergeyK12
      wrote on 15 Oct 2024, 20:38 last edited by
      #2

      Its possible to sort second table by id and then convert it into tree

      1 Reply Last reply
      0

      1/2

      15 Oct 2024, 20:03

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved