In QML, a models roles are usually used by their names as strings
.
However in some cases, this is not so. An example is the ListModel.onDataChanged
Here we have three arguments (see here) topLeft
, bottomRight
and roles
that we can use to handle the signal. While you can use the topLeft.row
easily to determine the index, I found no way to usefully evaluate the roles, that are given as a QVector<int>
, while for the QML-usage a QVector<string>
would be advantageous. To make things worse, roleNames
, available in C++ returning the mapping of the integer-representation of the role to the respective string representing the role name.
Luckily I have only a limited amount of roles, so I might handle it. But it would be really nice of QML to give me the information I so desperately seek. ;-)
So maybe you have a solution that does not need C++ (I might create a ProxyModel that then exposes the roleNames() for me)