KSortFilterProxyModel

Stephen Kelly steveire at gmail.com
Fri Nov 27 16:27:17 GMT 2009


Stephen Kelly <steveire <at> gmail.com> writes:
> 
> If this class is going to stick around, the name KSortFilterProxyModel isn't 
> the best, because that implies that it's the class you should always use in 
> KDE apps where otherwise a QSortFilterProxyModel would be used. This is 
> something dfaure brought up with me when I tried to do something similar 
> (which also had no effect by default.) Not sure if it's a big deal. Maybe 
> KTreeFilterProxyModel?
> 
> Finally, I think you have the wrong copyright in the .cpp file.

Hi, 

I know it's late but there are still some unresolved issues with this class.

Aside from these two, which are still in the same state as before, there
is the issue that this class might not update when the source model changes.

That is if the source model is 

A
B
- C
- - D
E
- F
- - G
H

and D and G match, the proxy will be as expected:

B
- C
- - D
E
- F
- - G

However, if I and J are then inserted and J also matches, this class will not
update because it is not listening to the source model signals, and QSFPM does
not automatically include them.

Expected: 

B
- C
- - D
E
- F
- - G
H 
- I
- - J

Additionally, I don't think the KSortFilterProxyModel would stand up well to
subclassing. The content of it would basically have to be duplicated in a 
subclass.

I've just started working on another proxy model which does recursive filtering
and does stay up to date. It has so far one virtual method to make subclassing
make sense. It should probably get another for column filtering, but I'm just
getting started.

http://websvn.kde.org/branches/work/akonadi-ports/kdepim/akonadi/akonadi_next
/krecursivefilterproxymodel.h?view=markup

http://websvn.kde.org/branches/work/akonadi-ports/kdepim/akonadi/akonadi_next
/krecursivefilterproxymodel.cpp?view=markup

I intend to move it into kdelibs 4.5. It does take care of the issues I raised
about KSortFilterProxyModel, and would make that class obsolete.

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.

Any thought on that? Should this be kept anyway?

Steve.

> 
> All the best,
> 
> Steve.
> 
> 








More information about the kde-core-devel mailing list