<HTML>
<HEAD>
<TITLE>Re: [PyQt] changing model for QTree</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>One easy solution to your issue is to use a QSortFilterProxyModel to “wrap” your model and only show the items you want visible.<BR>
<BR>
>From the documentation:<BR>
<BR>
</SPAN></FONT><FONT FACE="Times, Times New Roman"><SPAN STYLE='font-size:12pt'>QSortFilterProxyModel can be used for sorting items, filtering out items, or both. The model transforms the structure of a source model by mapping the model indexes it supplies to new indexes, corresponding to different locations, for views to use. This approach allows a given source model to be restructured as far as views are concerned without requiring any transformations on the underlying data, and without duplicating the data in memory.<BR>
<BR>
Here is the documentation link:<BR>
<BR>
<a href="http://doc.trolltech.com/4.4/qsortfilterproxymodel.html#details">http://doc.trolltech.com/4.4/qsortfilterproxymodel.html#details</a><BR>
</SPAN></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
There is a python example in <BR>
<BR>
examples/itemview/basicsortfiltermodel.py<BR>
<BR>
One word of caution, don’t forget to turn the dynamicSortFilter property on!<BR>
<BR>
Brian<BR>
</SPAN></FONT>
</BODY>
</HTML>