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

Justin Noel justin at ics.com
Tue May 18 16:48:35 CEST 2010


On 05/18/2010 10:35 AM, 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?
>
>    

Look at QAbstractItemModel::setRootIndex(...) I think that is what you 
want. When an index is selected in the left view call that on the right 
view.

Good luck,
--Justin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: justin.vcf
Type: text/x-vcard
Size: 233 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100518/3739d085/attachment.vcf 


More information about the Qt-interest-old mailing list