Details

    • Technical task
    • Resolution: Unresolved
    • P3: Somewhat important
    • 6.9
    • QML: Compiler
    • None
    • All

    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?

      Attachments

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

        Activity

          People

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

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes