[Qt-interest] Tree and Table view on same model

Andre Somers andre at familiesomers.nl
Tue May 18 16:42:44 CEST 2010


On 18-5-2010 16:35, Jonathan Lee wrote:
> Hi all,
>    not an expert on Qt so I hope this isn't too trivial.
>
>    I'd like a Tree and Table view on the same model, where
> the tree shows a structure, and the table shows the leaves
> of the selected item of the tree.
>
>    Specifically I have a zip viewer which shows the dirs
> on the left in a tree, and the files in that dir on the
> right in a table.
>
>    Right now I'm doing these two models separately, but
> it seems redundant.
>
>    What's the usual way of handling this? Make a proxy
> model for both views, using a common model? Or is
> there a cleaner way?
>
>    

You can use a common base model for both, and two proxy models that do 
the filtering.

André




More information about the Qt-interest-old mailing list