On Tue, Nov 8, 2016 at 6:56 PM Ruchit Bhatt <ruchitinnewfush...@gmail.com>
wrote:

> Hi,
> if i run below lines, QFileSystemModel will keep files with extension
> xml,txt & mel.
> But i want invert of this..(i.e i want to remove xml, txt & mel from
> QFileSystemModel)
> So tell me how to do this ??
>
> self.dirModel.setNameFilters(['*.xml', '*.txt', '*.mel'])
> self.dirModel.setNameFilterDisables(False)
>
>
>
Because the QFileSystemModel only lets you specify wildcard patterns to
match, you don't have a lot of flexibility with just that model. But if you
use a QSortFilterProxyModel then you can apply any kind of transformations
you want on the source model, before the view sees it.

I've put together an example for you:
https://gist.github.com/justinfx/dcdef94b2916ddd5f31e9f0921999fae

The proxy model is really basic, but you can see how it can be expanded to
do whatever kind of filtering options you want. I've just got it ignoring
rows where the basename ends in a particular extension.

Justin


>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/f2730d5e-9cdf-4041-b9dd-8c2bfa984efd%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/f2730d5e-9cdf-4041-b9dd-8c2bfa984efd%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2O_3wFx8xSONrknaC-rD7wNNMx7i%2BS16kc7E9uzkGYNw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to