QSortFilterModel - filter multiple columns
-
wrote on 11 Oct 2011, 14:13 last edited by
Hi All,
QSortFilterModel -using it i can filter a specific or all columns data but not more than one column.Is there a way to filter more than one column? for example i have 5 columns in TreeView.
Now i want to filter column-0, column-2, column-3 with filter text A,B,C respect to columns numbers.
How this can be accomplished?any help would be greatly appreciated
thanks in advance,
-
wrote on 11 Oct 2011, 14:46 last edited by
You can derive QSFPM and reimplement the filterAcceptsRow method and do the filtering there.
-
wrote on 11 Oct 2011, 15:17 last edited by
Hi Gerolf,
Thanks for the reply.I am already working on it.
-
wrote on 11 Oct 2011, 15:19 last edited by
First search if "somebody else":http://libqxt.bitbucket.org/doc/tip/qxtsortfilterproxymodel.html already invented the wheel before you start to develop your own wheel.
-
wrote on 11 Oct 2011, 16:27 last edited by
Hi Andre,
Thanks you so much for the link and putting me in the right direction. I will keep that in mind.Thanks again.
-
wrote on 15 Feb 2015, 17:53 last edited by
you can use 2 QSortFilterProxyModel:
the second QSortFilterProxyModel get his sourceModel from the first QSortFilterProxyModel who take his sourceModel from your sourcemodel ....its work -
wrote on 15 Feb 2015, 17:53 last edited by
you can use 2 QSortFilterProxyModel:
the second QSortFilterProxyModel get his sourceModel from the first QSortFilterProxyModel who take his sourceModel from your sourcemodel ....its work -
wrote on 15 Feb 2015, 19:03 last edited by
[quote author="david100100" date="1424022795"]you can use 2 QSortFilterProxyModel:
the second QSortFilterProxyModel get his sourceModel from the first QSortFilterProxyModel who take his sourceModel from your sourcemodel ....its work[/quote]It works, but it is really inefficient. Nice for a quick demo with a small number of items, but so nice for a big dataset in production.
(Thanks for providing a solution to an over 3 year old problem by the way...)
-
wrote on 15 Feb 2015, 19:03 last edited by
[quote author="david100100" date="1424022795"]you can use 2 QSortFilterProxyModel:
the second QSortFilterProxyModel get his sourceModel from the first QSortFilterProxyModel who take his sourceModel from your sourcemodel ....its work[/quote]It works, but it is really inefficient. Nice for a quick demo with a small number of items, but so nice for a big dataset in production.
(Thanks for providing a solution to an over 3 year old problem by the way...)
-
wrote on 24 Apr 2015, 15:50 last edited by
Good afternoon,
I am working on a specific project and I need this feature. The Qt version we are using is 4.8.6. I tried the solution of chaining QSortFilterProxyModel, but I found a strange behaviour at the time to map an item in the filtered final list and the data model.
Could somebody put a pice of code showing how it is supposed to be done the QSortFilterProxyModel chaining?
Thank you very much.
-
wrote on 24 Nov 2023, 02:04 last edited by
Here's an implement https://gist.github.com/mindon/a2a0432c9ede07b627f62af94ac95a96