Results 1 to 3 of 3

Thread: QT Model View - parent Item different from child

  1. #1

    Default QT Model View - parent Item different from child

    I have a list of items of a custom type like this:

    Provider1, Client1
    Provider2, Client1
    Provider3, Client2
    ...

    this can be done with list model, but each one of this provider could also have some "items" like this:
    Provider 1
    item1, place, type, date
    item2, place, type, date
    ...

    Conforming a tree:
    Provider
    -> items
    Provider 2
    -> items
    ...

    What do you think is the best way to implement the model?
    Should I make just 1 type of Item (sublcassing QAbstractItemModel)?
    Change the behavior (accepting corresponding attributes) depending on the hierarchy?

    Thanks in advance

  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: QT Model View - parent Item different from child

    What's the problem exactly? If you have different kinds of elements then you have different kinds of elements
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3

    Default Re: QT Model View - parent Item different from child

    Yes I found your article about the the OpenGL model. Is what I need; I will implement my model with 1 item and represent the different attributes as roles.

Similar Threads

  1. Replies: 12
    Last Post: 7th January 2011, 14:21
  2. Replies: 19
    Last Post: 25th November 2010, 09:52
  3. Insert parent item in proxy model
    By geflei in forum Newbie
    Replies: 0
    Last Post: 9th May 2010, 17:15
  4. Replies: 1
    Last Post: 1st February 2010, 19:42
  5. Default Item View classes and returning data from model
    By xerionn in forum Qt Programming
    Replies: 8
    Last Post: 23rd April 2009, 20:50

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.