Hi all,

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.

C++ side:
Qt Code:
  1. // Set the 'runtime' Context Property, this is my QQmlPropertyMap derived object
  2. Runtime rt;
  3. rt.GetData()->insert("abc", 120);
  4. rt.GetData()->insert("xyz", 65);
  5. view.rootContext()->setContextProperty("runtime", &rt);
To copy to clipboard, switch view to plain text mode 

QML side:
Qt Code:
  1. MyQmlObject
  2. {
  3. value: runtime.data.abc
  4. }
To copy to clipboard, switch view to plain text mode 

This next part is where I’m getting stuck/confused.. I want to have a QML table that displays 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.

Qt Code:
  1. TableView
  2. {
  3. anchors.fill: parent
  4. model: runtime.model // ????
  5. }
To copy to clipboard, switch view to plain text mode 

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?

Thanks