For this situation there is not out of the box solution you will have to write a custom TreeModel. you can find information about it here http://qt-project.org/doc/qt-4.8/ite...treemodel.html
For a system like this, I would use a JSon or XML file or a NoSql database. SQL databases arn't realy fit for storing tree information but here are some ways to do it in a SQL database, each approach has its drawbacks.
There are several options possible
1) a single data table with a link table for parrent child relations (with this solution you can make a tree with multiple levels):
Table 1 (data table):
id|name|value
Table 2 (parenting link table)
id|parent id|child id
both the parent and the child id are a Id from the data table (foreign key), there are some problems with this approach a child can have multiple parents and a parent can also be it's own child
2) a single table solution (multiple levels are possible)
Table 1 (data table with a id linking it to its parent)
id|name|value|parent id
The parent id points to a Id in the same table the top item should not have a parent id.
3) a table for parrent items and a table for child items (this solution can only have one level)
Table 1 (parent table)
id|name|value
Table 2 (child table)
id|name|value|parent id
the parent id points to the id of the parent table (foreign key)
4) a table that stores a JSon or XML file for each top item
id|name|blobFile
this way you only have a name for the top item, all the sub items are stored in the blobFile.
Bookmarks