[Interest] Why are QAbstractProxyModel::mapToSource and mapFromSource public?

Philipp Kursawe phil.kursawe at gmail.com
Wed Dec 11 17:36:36 CET 2013


When you have complex chain of ProxyModels you cannot use the result index
from a call to mapToSource because you cannot know how many proxy models
are down the chain.

Imagine this chain:
p2 -> p1 -> m0

pX are Proxy models, m0 is the base model.

I know only about p2 in my part of the code and want to know which index
that is in the m0 model.
So I would have to call p2->mapToSource, then p1->mapToSource and finally
have the index of m0.
In code that would be a loop over pX->sourceModel while the sourceModel is
a QAbstractProxyModel.

I understand the proper way to access data in the m0 model is to use the
data() method, which would internally correctly map the indicies.

I just wonder why the index mapping was made public API in the first place?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131211/e14c077c/attachment.html>


More information about the Interest mailing list