Results 1 to 14 of 14

Thread: View using multiple models

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2008
    Posts
    196
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 8 Times in 6 Posts
    Wiki edits
    1

    Default Re: View using multiple models

    Hello,

    i've the same problem, i need to merge 2 tree models into one treeview.
    The first model is a simple QStandardItemModel. The second model is a QDirModel.
    Now i want to display both models into one treeview. So from the posting i think i need an overlay...

    Qt Code:
    1. CustomModel Items
    2. Custom Item 1 (QStandardItemModel)
    3. Custom SubItem 1 (QStandardItemModel)
    4. Custom SubItem 2 (QStandardItemModel)
    5. Custom Item 2 (QStandardItemModel)
    6. Custom SubItem 1 (QStandardItemModel)
    7. Custom SubItem 2 (QStandardItemModel)
    8. DirModel Items
    9. C: (QDirModel)
    10. Qt (QDirModel)
    11. 2010.05 (QDirModel)
    To copy to clipboard, switch view to plain text mode 

    So, i think i need two functions setCustomModel(QAbstractItemModel *pModel); and a function setDirModel(QAbstractItemModel *pModel); for example.
    But how can i handle it that when i click on an item in the QDirModel to display a file content and if i click on an item in the QStandardItemModel to display for example the a string? To simplify this, i want to know how the treeview knows which model must be accessed.

    I've also attached a screenshot of the current situation. In the left (empty) TreeView i will merge the right ones.

    Thanks in advance

    Best Regards
    NoRulez
    Attached Images Attached Images

Similar Threads

  1. QTreeView and multiple models
    By Daher in forum Qt Programming
    Replies: 3
    Last Post: 3rd December 2019, 20:57
  2. QTreeView with multiple models
    By Daher in forum Qt Programming
    Replies: 5
    Last Post: 18th October 2011, 10:53
  3. QSortFilterProxyModel with multiple source models
    By hoshy in forum Qt Programming
    Replies: 1
    Last Post: 26th August 2009, 20:59
  4. Replies: 3
    Last Post: 5th October 2008, 23:41

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