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

Konstantin Shegunov kshegunov at gmail.com
Mon Mar 7 10:59:54 CET 2022


Hi,

On Mon, Mar 7, 2022 at 11:20 AM Ulf Hermann <ulf.hermann at qt.io> wrote:

> QQmlPropertyMap::setValue(key, value) should trigger the change signal
> of the property.
>

Do you possibly mean QQmlPropertyMap::updateValue, because I don't see a
setValue method in the documentation. Either way it doesn't appear to work
for me, which made me muse a bit. Is it possible that it doesn't update
because my property is a gadget and the binding is through an implicit
QString conversion? Additional piece of information that may be relevant is
that the QObject which exposes the dynamic properties is a 'constant'
property of another object (I don't want to allow it get set from QML),
should this be a problem, I'd assumed not?

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.
>

Noted (also confirmed by my experiments).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20220307/d9ef994f/attachment.htm>


More information about the Interest mailing list