Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QAbstractItemModel get view
damianatorrpm last edited by
Is it possible in the data() function of an abstract item model to get the QObject* of the requesting view?
You can't and you should not do that.
Why would you need that information in your model ?
damianatorrpm last edited by damianatorrpm
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.