Results 1 to 3 of 3

Thread: How use Model view with a tree wich have Cycle ?

  1. #1
    Join Date
    Jul 2006
    Location
    France
    Posts
    34
    Thanks
    12
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default How use Model view with a tree wich have Cycle ?

    Hy,

    I've got a tree with cycle in it, and I would like to represent it in Qt, how can I ?

    Because the parent for a QModelIndex is not always the same, so how can we handle it ?

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How use Model view with a tree wich have Cycle ?

    A tree by definition has no cycles If you want to represent a graph, you won't be able to show it in one of the standard views anyway, so the implementation of parent has less meaning. Just return a proper parent index for the item, if it has two parents, return always the same one. There is a chance it will work although be aware the architecture was not built for such uses. It might be better to store the data as a neighbourhood matrix or not to use itemviews at all.

  3. The following user says thank you to wysota for this useful post:

    weepdoo (9th December 2008)

  4. #3
    Join Date
    Jul 2006
    Location
    France
    Posts
    34
    Thanks
    12
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How use Model view with a tree wich have Cycle ?

    Thanks for the tips.

    I'm going to doing it manualy

Similar Threads

  1. hierarchical model in a flat view
    By gniking in forum Qt Programming
    Replies: 4
    Last Post: 10th November 2009, 20:17
  2. Radio buttons in a tree view
    By notwithstanding in forum Qt Programming
    Replies: 6
    Last Post: 3rd November 2008, 22:32
  3. Model, View and Proxy
    By No-Nonsense in forum Qt Programming
    Replies: 2
    Last Post: 21st November 2006, 08:50
  4. Model - View Programming doubt.
    By munna in forum Qt Programming
    Replies: 4
    Last Post: 28th April 2006, 13:01
  5. Replies: 6
    Last Post: 20th April 2006, 10:23

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.