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. Tree of Items served by QAbstractItemModel derived class and keeping it in SQLite database. How to?
QtWS25 Last Chance

Tree of Items served by QAbstractItemModel derived class and keeping it in SQLite database. How to?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 837 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.
  • K Offline
    K Offline
    Kofr
    wrote on last edited by
    #1

    I need to keep whole Tree of items in persistant storage SQLite database.
    Shall I use QSqlQueryModel? Is that best way to sync data of treeStructure? How to implement this task the best way?

    kshegunovK 1 Reply Last reply
    0
    • K Kofr

      I need to keep whole Tree of items in persistant storage SQLite database.
      Shall I use QSqlQueryModel? Is that best way to sync data of treeStructure? How to implement this task the best way?

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

      Look here.
      Couple that with the typical child->parent relationship and you can efficiently represent the hierarchical data in SQL database. As for the model, it's just an interface for the view, you should keep your data in your own structure anyway.

      Read and abide by the Qt Code of Conduct

      K 1 Reply Last reply
      2
      • kshegunovK kshegunov

        Look here.
        Couple that with the typical child->parent relationship and you can efficiently represent the hierarchical data in SQL database. As for the model, it's just an interface for the view, you should keep your data in your own structure anyway.

        K Offline
        K Offline
        Kofr
        wrote on last edited by
        #3

        @kshegunov thank you, but there is question of what class sould I use to serve this task. Because serving SQL table manually, by using SQL queries as adding rows, moving rows, etc are very labour-expensive.
        Is there a solution for this task?

        kshegunovK 1 Reply Last reply
        0
        • K Kofr

          @kshegunov thank you, but there is question of what class sould I use to serve this task. Because serving SQL table manually, by using SQL queries as adding rows, moving rows, etc are very labour-expensive.
          Is there a solution for this task?

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

          @Kofr said in Tree of Items served by QAbstractItemModel derived class and keeping it in SQLite database. How to?:

          Is there a solution for this task?

          The only solution I know of is to write your own class.

          Read and abide by the Qt Code of Conduct

          1 Reply Last reply
          1

          • Login

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