PDA

View Full Version : A simple QTreeView with a QSql(Relational)TableModel



Jarvis
24th March 2010, 14:32
Hi everyone !

I have a very simple table Classes containing three fields: id, id_parent and description, with id_parent relating to id on the same table. I would like to see its content as a tree nodes view. Example :

[id]; [id_parent]; [description]
1; NULL; Drinks
2; 1; Soft drinks
3; 1; Beers
4; 1; Whiskeys
5; NULL; Food
6; 5; Breakfast
7; 5; Beef
8; 5; Fish

That's it; Soft drinks, Beers and Whiskeys are sub-nodes of Drinks which is a root item. Is there a quick and simple way to create a model that could be set to the view so that items would be displayed automatically ?

Many thanks for you help !

Cheers.

Jarvis
24th March 2010, 14:41
Shame on me... I haven't seen that something similar was already asked... and answered !
I wish I could delete that thread...

Jarvis
25th March 2010, 13:21
What I found yesterday doesn't match my requirements. So if anyone has an answer, please tell me !

Many thanks again.