[Interest] [QML][C++][Context] change property into context

Jérôme Godbout jerome at bodycad.com
Thu May 5 20:33:00 CEST 2016


Hi,
I would like to known if there's a way to efficiently change the value into
a context and emit changed() signal without having setContextProperty()
forcing whole context revaluation?

Let say I have a special Repeater alike component that create and maintain
expensive Object that add index,value into the context (that's just an
example). I would like to avoid deleting/creating all item but just change
the index of one of them.

Ex my component create the following Object list:
[O0, O1, O2, O3, O4]

A command remove O1:
I would like instead of creating all and deleting all previous or making
[O0, O2, O3, O4] I would like to create [O0, O4, O2, O3] and change the
context values of O4 only, reducing the number of binding evaluation.

I was wondering if that possible to set context property value after object
creation and emit the changed? is it safe to call setContextProperty on
already created object? I guess it is, but would be very slow to change
multiple value into it (not so bad we only have 2 of them to set on a
limited number of object, would still be a gain over current implementation
we have or what repeater does too).

This would be very nice to achieve that for some very long repeated GUI
list item we have that.

Thanks,
Jerome
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160505/15038d96/attachment.html>


More information about the Interest mailing list