|
|||||||
| Newbie Newbie to Qt? Ask your questions here. |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I've been looking at examples and reading docs etc. I'd like run my thoughts by someone on how this would work, because I haven't run across this scenario anywhere.
Problem: I would like to use a custom QDirModel for two TreeViews in one splitter pane, but I'd like to customize the look of one vs the other. currently doing via two QDirModels... ![]() So on the left side I would like just folders and the name column (in TreeView form) On the right I'd like the full up TreeView. So would I implement this by using a QAbstractItemModel? If, yes how would this be accomplished? If no how can I use one custom QDirModel in two TreeViews with different layouts? What are your thoughts? |
|
#2
|
|||
|
|||
|
Hide all the columns but the first one in the tree. If you want to filter out files, use QSortFilterProxyModel and in its filterAcceptsRow() check if the index is a file or a directory and return false or true respectively. Then you'll be able to use one model for both views (one of them will additionaly be using a proxy model).
|
| The following user says thank you to wysota for this useful post: | ||
killerwookie99 (15th August 2008) | ||
|
#3
|
|||
|
|||
|
What about QProxyModel? It says not to use it, is there something better?
Last edited by killerwookie99; 15th August 2008 at 01:31. |
|
#4
|
|||
|
|||
|
Yes, you have a link to the docs in my previous post.
|
| The following user says thank you to wysota for this useful post: | ||
killerwookie99 (15th August 2008) | ||
|
#5
|
|||
|
|||
|
Alright I'll stick with it, its use is just a little confusing for me.
Last edited by killerwookie99; 15th August 2008 at 18:01. |
|
#6
|
|||
|
|||
|
What is confusing? The difference between QProxyModeland QAbstractProxyModel which is the base of QSortFilterProxyModel?
|
|
#7
|
|||
|
|||
|
When I try to do this it segfaults and I'm not sure if it's because I'm missing a function or what, but here's a simplistic version of what I tried to do...oh and it segfaults even when I comment out filterAcceptsRow...
MySortFilterProxyModel.h Qt Code:
Qt Code:
... Qt Code:
Any ideas? |
|
#8
|
|||
|
|||
|
What is the source model? Is it a custom model or a predefined one?
|
|
#9
|
|||
|
|||
|
It's using the regular qdirmodel from qt...
|
|
#10
|
|||
|
|||
|
Could you print the backtrace from the debugger upon the segfault?
|
|
#11
|
|||
|
|||
|
You want a truss or something different, sorry my debugger knowledge is limited...
|