[Development] filtering using QSortFilterProxyModel

h hdixon at bigpond.net.au
Sat Sep 28 10:41:38 CEST 2013


Hi all,
Firstly, I am off line a fair bit at the moment, so if you can reply to
this post it will be greatly appreciated, but I may be slow to respond.

I am wanting to filter data from a QAbstractTableModel into a
QTableView through a QSortFilterProxyModel.  I have the app working
well, with sort implemented in my QSortFilterProxyModel subclass.

I have QDate data in my table and am wanting to display data only from
selected days, ranges of days or days of the week.

From my reading of the documentation, QSortFilterProxyModel will filter
on a regex, but nothing else.  Is this correct?  I would like to write
a function returning a boolean that will either drop the dataitem or
pass it through.  I cannot see how to do this.

Can someone please advice on how to filter based on data types, not
just strings, which I believe is a condition of regex?
I would like to introduce a number of more complex filters than just
date, so a solution to something beyond regex rather than how to
express date as a regex would be appreciated.

I am developing on OpenSUSE 12.3 with Qt 5.1.0 64 bit.

With thanks,
Hugh






More information about the Development mailing list