PDA

View Full Version : [QSortFilterProxyModel] filtering depends on child element



maximAL
10th January 2008, 13:11
hello,
i want to use a QSortFilterProxyModel to filter data according to it's elements sub-elements, so if element E has child C with value X = FORBIDDEN, element E has to be filtered out.
the problem seems to be that filtering is done on the fly while inserting data into the source model, so when E is inserted, C doesn't exist yet and when C is inserted, you can't filter out E anymore.
so, is there some good solution for that?
sure, i could disable all the proxies while inserting data, but that seems to be rather ugly.

wysota
10th January 2008, 14:38
You could filter out all elements that don't have children yet :) Or invalidate the filter when an item receives a child.