Hi all, I've been constructing a proxy model that hides multiple underlying models. In this process, I have to translate the custom roles for each model. E.g. the custom role enumeration for the duration of a music track is not the same as for an album, but when accessed through my proxy model, it should be. This is where I encountered an issue with the current proxy models (in Qt 4.8).
The role names for the model being proxied is copied each time setModel is called. This means that the role names might change while the model lives - something that does not work well with QML (as is pointed out by the documentaiton). It also means that any calls to setRoleNames in the c'tor of the proxy model are futile - the roles are replaced when a model is set. In my opinion, this behavior should not be enforced at the current level, i.e. in QAbstractProxyModel, but rather, in each specific implementation, e.g. in QAbstractSortfFilterProxyModel, but not in QIdentityProxyModel, so that a role-tranforming-proxy, like the one I created, can be implemented. Introducing this in the 4.x tree might be considered to break the API, but this is definitely something that I would like to see in Qt 5. Does anyone object to this? Or is it time to submit a small patch? Best regards, Johan Thelin Recommended on-line reading: http://www.thelins.se | http://www.qtcentre.org Recommended off-line reading: The Foundations of Qt Development (ISBN: 1-59059-831-8) _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
