Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
sBoff last edited by
I'm trying to get my head around this and after much research and testing I feel I must be missing something simple.
I have a QQmlPropertyMap derived object that I am adding to in my C++ code. I am then binding to the data in my QML - this is all working great. When I update the value on the C++ side my UI also updates.
// Set the 'runtime' Context Property, this is my QQmlPropertyMap derived object
This next part is where I'm getting stuck/confused.. I want to have a QML table that displayes all the key/values in the property map and automatically updates. How do I go about this? I cant find any examples that use the QQmlPropertyMap as a model for a TableView or any other view.
model: runtime.model // ????
Basically what I've done for the time being is created a QAbstractTableModel derived object that takes my QQmlPropertyMap object as a paramater. This enables me to expose a QAbstractTableModel to my QML and for the data to be correct however, when it came to the stage of having to update the data I need to do 'tricks' to get the QAbstractTableModel updated in sync with the QQmlPropertyMap. If i have to manually keep a QAbstractTableModel in sync with a QQmlPropertyMap this completly negates me using a QQmlPropertyMap in the first place (which was to easily update my UI as the data changes).
Surely there must be a simple way I'm not aware of? How can I use a QQmlPropertyMap as the model for the QML TableView?