KSortFilterProxyModel
Stephen Kelly
steveire at gmail.com
Sun Nov 29 11:54:32 GMT 2009
John Tapsell wrote:
> 2009/11/28 David Faure <faure at kde.org>:
>> On Saturday 28 November 2009, David Faure wrote:
>>> On Friday 27 November 2009, Stephen Kelly wrote:
>>> > To avoid having a proxy model which does not update on source model
>>> > change and which will likely be replaced in 4.5, I think it would be
>>> > best to remove KSortFilterProxyModel from kdelibs4.4, and use
>>> > KRecursiveFilterProxyModel in 4.5 after it has been tested.
>>>
>>> If it's new in 4.4 and nothing uses it yet (you checked lxr, I
>>> presume?),
>>
>> Oh wait. This is the same KSortFilterProxyModel as the one that konqueror
>> is using for its history treeview, so that the filtering lineedit works
>> on child nodes (which contain the page titles).
>> Very useful indeed, don't remove it :-)
>> Could be renamed though, to get a more specific name.
>> KFilterChildrenProxyModel? sounds like the opposite of what it does,
>> though. Maybe KMatchChildrenProxyModel?
>
> Well if it's being replaced with a bug-fixed version, couldn't
> konqueror switch to using that? :)
Yes, I checked lxr. http://lxr.kde.org/ident?i=KSortFilterProxyModel
It is used in two locations in kdebase.
I've just checked in a testcase to show the issue I was describing at
playground/libs/ksfpm_testcase
Just checkout and qmake && make && ./ksfpm_testcase.
There are 4 tree views. The left one is a regular QAbstractItemModel, then a
KSortFilterProxyModel, then KRecursiveFilterProxyModel with a filter regexp,
then KRecursiveFilterProxyModel with subclass filtering. You can insert and
remove rows with the Insert button. The KSortFilterProxyModel does not
update, and the other two (my replacement class) does. The
KRecursiveFilterProxyModel also doesn't quite work yet, and I don't need the
SignalSpys in there and there are some unneeded loops, but it shows the
issue.
My suggestion is putting a copy of KSortFilterProxyModel in the two places
in kdebase that it is used, and then using the KRecursiveFilterProxyModel
when it is stable in 4.5.
I can't build KDE today (hence the qt testcase), so I would prefer if
someone else could do the move/copy so I don't break things.
John could you do that?
All the best,
Steve.
More information about the kde-core-devel
mailing list