[Interest] Internal QML context does not accept property
Richard Weickelt
richard at weickelt.de
Thu May 10 21:06:44 CEST 2018
I am loading a QML document with the following structure:
A {
B {
}
B {
}
}
At some point in the application I am iterating over all B components and
want to do:
qmlContext(B)->setContextProperty("bla", "value")
I need to assign different values to each instance of B. But I get the warning:
QQmlContext: Cannot set property on internal context.
Questions:
1. The "internal context" surprises me. Does QQmlEngine
create a new sub-context for each component?
2. Why is this "internal" context not writable? Is this documented
somewhere?
3. Does anybody know a work-around? I tried to set the property
on B with QObject::setProperty(), but that isn't recognised
(bindings are not re-evaluated).
Thanks
More information about the Interest
mailing list