You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Wednesday, March 5th 2008, 1:37am

Inherit from QSortFilterProxyModel

Hello

I use a custom ProxyModel that inherits from QSortFilterProxyModel and overwrites the following methods of QSortFilterProxyModel.

Source code

1
2
3
protected:
    virtual bool lessThan ( const QModelIndex & left, const QModelIndex & right ) const;
	virtual bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const;

The constructor looks like

Source code

1
2
 MySortFilterProxyModel::MySortFilterProxyModel()
:   QSortFilterProxyModel() {} 


Everything works pretty well, except that my ProxyModel resorts and calls filterAcceptsRow when the source model emits the dataChanged even if dynamicSortFilter is set to false.

A look at the QSortFilterProxyModel.cpp under
http://www.koders.com/cpp/fidB9A2451A0F6…e+mdef%3Ainsert
did not help me to solve the problem.

As far as I can see Trolltec's example implementation at
http://doc.trolltech.com/4.3/itemviews-c…oxymodel-h.html
does not use any tricks to inherit from QSortFilterProxyModel.

I use Qt 4.3, the QSortFilterProxyModel documentation can be found under
http://doc.trolltech.com/4.3/qsortfilterproxymodel.html

I'm grateful for any help,
norbnorb

2

Thursday, March 6th 2008, 10:23pm

bump

still having the same problem.
Does no one have an idea?