• All

      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?

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            ulherman Ulf Hermann
            cajus Cajus Pollmeier
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes