Results 1 to 2 of 2

Thread: Model of models

  1. #1
    Join Date
    Feb 2013
    Posts
    38
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Model of models

    Hi,

    I have a class MyObject and a class MyObjectContainer.
    An object container contains a list of MyObject objects.
    Each MyObject owns a QStandardItemModel.
    The MyObjectContainer owns a QStandardItemModel.

    I want to create a tree view where I insert the model of MyObject in the model of MyObjectContainer.

    I tried to copy node, to play with invisibleRootNode...I did not success.

    Thanks,

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Model of models

    What you will most likely need is a model class derived from QAbstractItemModel that works on a MyObjectContainer.
    When it gets requests for the top level, delegate to the MyObjectContainer model. When it gets requests for the second level, find the appropriate MyObject and delegate to its model.

    Cheers,
    _

Similar Threads

  1. Replies: 1
    Last Post: 29th August 2013, 05:41
  2. Switching between models
    By janorcutt in forum Qt Programming
    Replies: 1
    Last Post: 24th January 2012, 19:52
  3. Viewer for 3D Models
    By bts in forum Newbie
    Replies: 2
    Last Post: 3rd March 2011, 14:45
  4. sql models
    By damiano19902 in forum Newbie
    Replies: 1
    Last Post: 4th June 2009, 07:18
  5. Proxy models and slection models
    By amunitz in forum The Model-View Framework
    Replies: 1
    Last Post: 23rd September 2008, 14:35

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.