Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
6.4.1
Description
This is maybe more a question than a bug: If you use something like this (used in a similar way in Tumbler.qml):
Control {
id: control
contentItem: Repeater {
delegate: Item {
function foo() {
let ready = control.contentItem.areYouReady
}
}
readonly property bool areYouReady: true
}
}
, you're getting
Warning: main.qml:31:53: Property "areYouReady" not found on type "QQuickItem" let ready = control.contentItem.areYouReady ^^^^^^^^^^^ Error: main.qml:31:53: Could not compile function foo: Cannot load property areYouReady from QQuickItem of QQuickControl::contentItem with type QQuickItem. let ready = control.contentItem.areYouReady ^^^^^^^^^^^
which sounds plausible.
I'd tend to write it like this instead:
Control {
contentItem: Repeater {
id:item
delegate: Item {
function foo() {
let ready = item.areYouReady
}
}
readonly property bool areYouReady: true
}
}
, but that renders into
Warning: main.qml:12:9: Cannot defer property assignment to "contentItem". Assigning an id to an object or one of its sub-objects bound to a deferred property will make the assignment immediate. contentItem: Repeater { ^^^^^^^^^^^
. This are less warnings, and it seems like these
Q_CLASSINFO("DeferredPropertyNames", xyz)
are kind of internal, or the documentation is hidden somewhere.
So - which version is better? Or is there one without any warnings?
PS: the Jira "what you see is what you want to get" editor sucks