PDA

View Full Version : QAbstractProxyModel subclass to present single item (index)



infyar
11th June 2013, 11:50
Good news everyone (c)!
Could you please explain me how to make a "cut" or "slice" of a QStadardItemModel.
What I want is to make a QAbstractProxyModel subclass with very simple functionality: programmer sets a model to proxy and an index from that model, proxy becomes a flat table model which contains children of that index (but not children of children). That is all.
If anyone colud show me lines of code implementing mapToSource(), mapFromSource() and filterAcceptsRow() functions assuming that source model is QStandardItemModel I would be as happy as an elephant!

PS
If I have to reimplement anything except data(), parent(), mapToSource(), mapFromSource() and filterAcceptsRow() please tell me!