Results 1 to 4 of 4

Thread: QTreeView with multiple QDir models

  1. #1
    Join Date
    Jan 2011
    Posts
    55
    Thanks
    12
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default QTreeView with multiple QDir models

    I'd like to display multiple directory models into a QTreeview, like this for example:
    Qt Code:
    1. C:\
    2. temp1
    3. temp2
    4. D:\
    5. temp1
    6. temp2
    7. E:\
    8. temp3
    9. temp4
    10. C:\myFolder
    11. temp5
    12. temp6
    To copy to clipboard, switch view to plain text mode 
    I've searched in the forum and it seems it could be done using a proxy model? Any chance to get some example code?

    I also would like to ask if there is a way to get the number of current rows displayed in the QTreeView. It seems there is no such function...
    Last edited by papillon; 18th October 2011 at 00:56.

  2. #2
    Join Date
    Nov 2011
    Posts
    14
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4 Qt Jambi
    Platforms
    MacOS X Windows

    Default Re: QTreeView with multiple QDir models

    Having the same problem here. I can not find a simple example for beginners

  3. #3
    Join Date
    Jan 2011
    Posts
    55
    Thanks
    12
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QTreeView with multiple QDir models

    Take a look at this thread: http://www.qtcentre.org/threads/4534...ght=multimodel

    d_stranz was so kind to make and share a working example!

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QTreeView with multiple QDir models

    Yes, but as I say in that thread, I was not able to get it to work successfully with directories as the child models. I think it has something to do with the fact that the file system model uses a watcher, and the tree does not get filled in completely. I don't have the time to play with it now, so if someone else can figure out what is wrong, that would make it a better example.

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. View using multiple models
    By johnmauer in forum Qt Programming
    Replies: 13
    Last Post: 5th October 2010, 18:28
  4. QSortFilterProxyModel with multiple source models
    By hoshy in forum Qt Programming
    Replies: 1
    Last Post: 26th August 2009, 20:59
  5. QDir create multiple dirs
    By ^NyAw^ in forum Qt Programming
    Replies: 2
    Last Post: 4th March 2009, 12:13

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.