Results 1 to 10 of 10

Thread: Hierarchical disparate data structure and MVD (QStandardItemModel / QTreeView)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2016
    Location
    New England, US
    Posts
    31
    Thanks
    6
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Hierarchical disparate data structure and MVD (QStandardItemModel / QTreeView)

    I am in the process of developing an application which will have a "model tree" that helps users navigate around the data (model) and do their task. My rendering of "my model tree" since the image didn't upload:

    |--Collection1
    | |--c1-1, etc.
    |
    |--Collection2
    | |--c2-1, etc.
    |


    I have wired context sensitive menus to the model tree, albeit clunky, they seem to work. FYI, there are disparate data structures at different levels in the tree, but usually small in size. Except at the leaf node, where they can be large, like a long table with 100k rows and 3-6 columns. I have gone through most MVD (model/view/delegate) examples, worked out a few myself (helps a lot!).

    I derive from QStandardItemModel / QTreeView for the model/view aspect of "my model tree". For my prototype I have assumed QString for each item so that I can use
    Qt Code:
    1. model->data(Qt::DisplayRole).toString()
    To copy to clipboard, switch view to plain text mode 
    to create and display "my model tree". Now my 2-part question:

    1. I believe that I cannot use QStandardItemModel to represent disparate hierarchical data structures, where each node has its own data structure, not just different data. In this case I should derive from QAbstractItemModel, right?

    2. Continue to use QStandardItemModel / QTreeView, or their subclasses, for "my model tree" and context menus. But for the actions triggered by the context menus, I could subclass from QAbstractItemModel in order to handle complex data structures, large tables and their views. Am I heading in the right direction?

    Thanks for your comments and help.
    Last edited by NameRakes; 24th December 2016 at 06:51. Reason: updated contents

Similar Threads

  1. Searching a hierarchical QStandardItemModel
    By Zoober7 in forum Qt Programming
    Replies: 5
    Last Post: 21st June 2013, 09:45
  2. Replies: 1
    Last Post: 3rd November 2011, 22:17
  3. QStandardItemModel, parent / child to form tree structure
    By Nightfox in forum Qt Programming
    Replies: 2
    Last Post: 8th January 2010, 17:01
  4. Saving hierarchical structures of data.
    By psih128 in forum Qt Programming
    Replies: 1
    Last Post: 30th July 2009, 08:33
  5. Display data from QStandardItemModel in QTreeView
    By jprice01801 in forum Qt Programming
    Replies: 7
    Last Post: 10th January 2007, 09:34

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
  •  
Qt is a trademark of The Qt Company.