Results 1 to 3 of 3

Thread: A simple QTreeView with a QSql(Relational)TableModel

  1. #1
    Join Date
    Mar 2010
    Location
    Belgium
    Posts
    14
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question A simple QTreeView with a QSql(Relational)TableModel

    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.

  2. #2
    Join Date
    Mar 2010
    Location
    Belgium
    Posts
    14
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: A simple QTreeView with a QSql(Relational)TableModel

    Shame on me... I haven't seen that something similar was already asked... and answered !
    I wish I could delete that thread...

  3. #3
    Join Date
    Mar 2010
    Location
    Belgium
    Posts
    14
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Re: A simple QTreeView with a QSql(Relational)TableModel

    What I found yesterday doesn't match my requirements. So if anyone has an answer, please tell me !

    Many thanks again.

Similar Threads

  1. object-relational mapping support?
    By brcain in forum Qt Programming
    Replies: 18
    Last Post: 28th January 2016, 11:42
  2. Simple way to expand all nodes on a QTreeView?
    By cboles in forum Qt Programming
    Replies: 10
    Last Post: 12th April 2014, 16:54
  3. simple question;QSplitter,QTreeView
    By weixj2003ld in forum Qt Programming
    Replies: 2
    Last Post: 8th April 2009, 10:59
  4. QSql*Model + QTreeView : make a tree
    By punkypogo in forum Qt Programming
    Replies: 18
    Last Post: 24th October 2008, 18:14
  5. Relational Table Model Problem
    By aekilic in forum Qt Programming
    Replies: 2
    Last Post: 20th January 2007, 14:57

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.