PDA

View Full Version : QTreeView with multiple QDir models



papillon
18th October 2011, 00:01
I'd like to display multiple directory models into a QTreeview, like this for example:


C:\
temp1
temp2
D:\
temp1
temp2
E:\
temp3
temp4
C:\myFolder
temp5
temp6

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...

Mint87
11th November 2011, 10:30
Having the same problem here. I can not find a simple example for beginners:(

papillon
11th November 2011, 14:07
Take a look at this thread: http://www.qtcentre.org/threads/45342-QTreeView-auto-resize?highlight=multimodel

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

d_stranz
11th November 2011, 23:23
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.