2014-03-26 11:44 GMT+04:00 Koen Deforche <[email protected]>:
> Hey Georg,
>
> 2014-03-25 18:47 GMT+01:00 Georg Rudoy <[email protected]>:
>>
>> I am writing a subclass of WSortFilterProxyModel that needs to support
>> custom filtering conditions that should be dynamically updatable. Is
>> there a way to invalidate filtering other than calling something like
>> setFilterRegExp(filterRegExp())
>> in order to cause resetMappings() be called?
>
>
> Interestingly there does not seem to be a good API method for that
Probably just making a private method that does
layoutAboutToBeChanged()();
resetMappings();
layoutChanged()();
will do?
Relying on current setFilterRegExp() behavior seems not future-proof
enough: you may add a check in the next Wt version to avoid
invalidating the model if the regexp is the same, for example, and
then my kludge will break.
> (and I couldn't find one in QSortFilterProxyModel either).
There are two methods: the invalidate() public slot and the
invalidateFilter() protected method. The difference is a little
error-prone though.
>> One unpleasant side effect of such kludge for model invalidation is
>> that item view loses selection. Can this be avoided somehow?
>
>
> By implementing toRawIndex() and fromRawIndex() in the source model.
Great, thanks! That worked like a charm.
--
Georg Rudoy
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest