[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] changing model for QTree
From: Brian Kelley <kelley () eyesopen ! com>
Date: 2009-01-28 23:21:01
Message-ID: C5A6528D.70E6%kelley () eyesopen ! com
[Download RAW message or body]
One easy solution to your issue is to use a QSortFilterProxyModel to "wrap"=
your model and only show the items you want visible.
>From the documentation:
QSortFilterProxyModel can be used for sorting items, filtering out items, o=
r both. The model transforms the structure of a source model by mapping the=
model indexes it supplies to new indexes, corresponding to different locat=
ions, for views to use. This approach allows a given source model to be res=
tructured as far as views are concerned without requiring any transformatio=
ns on the underlying data, and without duplicating the data in memory.
Here is the documentation link:
http://doc.trolltech.com/4.4/qsortfilterproxymodel.html#details
There is a python example in
examples/itemview/basicsortfiltermodel.py
One word of caution, don't forget to turn the dynamicSortFilter property on=
!
Brian
[Attachment #3 (text/html)]
<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>
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
--===============0806756044==--
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic