[Interest] [Qt6] QML notify dynamic property changes from C++

Ulf Hermann ulf.hermann at qt.io
Mon Mar 7 10:19:29 CET 2022


Hi Konstantin,

> I have exposed some dynamic properties through QQmlPropertyMap to the 
> QML engine and that works well. However I need to change the values from 
> C++ and want to notify the bindings about the property change from 
> there. Is there a way to do it?

QQmlPropertyMap::setValue(key, value) should trigger the change signal 
of the property. That, in turn, should update any QML bindings that 
depend on the value. If it doesn't work, please post a bug report with a 
minimal example project.

Mind that "QVariant &operator[](const QString &key)" is broken in that 
way. It cannot possibly notify if you change the value through the 
reference it returns.

best regards,
Ulf


More information about the Interest mailing list