QAbstractItemModel get view
-
Is it possible in the data() function of an abstract item model to get the QObject* of the requesting view?
-
Hi,
You can't and you should not do that.
Why would you need that information in your model ?
-
@SGaist
Hi,The model should return different values for the different requesters (different windows, same model).
Currently I'm using a QList (I'm sure the performance if it were possible would be much better in my usecase) with all the information, but it's pretty complex as qml sortfilterproxymodel is also being used. If you are certain that this is not possible, than the question is answered, thanks! -
Then you should use the appropriate roles from your views to request the data. It's not the role of the model to accommodate the views that are on top of it.