"La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
~Napoleon Bonaparte
On a crusade to banish setIndexWidget() from the holy land of Qt
This example helped me a lot, I implemented it in python. Hereby the corresponding code:
class FilterProxyModel(QtCore.QSortFilterProxyModel):
def __index__(self):
super(FilterProxyModel, self).__index__(self)
def filterAcceptsRow(self, p_int, QModelIndex):
res = super(FilterProxyModel, self).filterAcceptsRow(p_int, QModelIndex )
idx = self.sourceModel().index(p_int,0,QModelIndex)
if self.sourceModel().hasChildren(idx):
num_items = self.sourceModel().rowCount(idx)
for i in xrange(num_items):
res = res or self.filterAcceptsRow(i, idx)
return res
I hope it helps someone els