This is not possible with standard Qt signals. I suggest adding another signal for this.
For my own models, I usually use this approach: I have a root instance containing pointers to all parts of my data model. My model elements use this root instance to send signals of type
itemChanged(item, attribute, oldValue, newValue)
for simple properties. The same goes for lists, etc .; only here I have several signals depending on the action, for example:
itemAdded(list, item, index)
[EDIT] QT signal processing is very simple. Usually it says only "something has changed." There is no support, "what exactly has changed?" since you don’t need it most of the time. Therefore, if you need this information, you must do it yourself. You cannot use one role because the roles must be supported by something in your element. What you can do is add change information to your objects and read when the role is requested. But this is not what is supported out of the box.
source share