There are at least two possible approaches. One is to determine in the delegate and in the proxy whether the index contains the address card or the prefix header and act accordingly in paint() and in filterAcceptsRow(). Another is to make your model a tree model where prefixes are at level 0 of the model and address cards at level 1 and only filter out items at level 1 (adjusting filterAcceptsRow accordingly) and painting items differently in paint() depending on their level in the hierarchy. You could either use QTreeView with a customized tree drawing to get rid of branches and indentation or a QListView with a proxy model that flattens the original model (but painting and filtering should still be aware of the underlying model).





Reply With Quote

Bookmarks