Details
-
Technical task
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
Description
When using a Loader component combined with a bound property, the compiler claims that this is not compilable, spitting a couple of warnings/errors. So
Loader { id: loader readonly property int foo: loader.item && loader.hasOwnProperty("bar") ? loader.item.bar : 0 }
results in
Warning: main.qml:12:94: Property "bar" not found on type "QObject" readonly property int foo: loader.item && loader.hasOwnProperty("bar") ? loader.item.bar : 0 ^^^ Error: main.qml:12:94: Could not compile binding for foo: Cannot load property bar from QObject of QQuickLoader::item with type QObject. readonly property int foo: loader.item && loader.hasOwnProperty("bar") ? loader.item.bar : 0 ^^^
.
Is there a cleaner way to do it? If there's none, how to get rid of the warning/error?