Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-20198

QML property of items can't assign to an instance of that item by id

    XMLWordPrintable

Details

    Description

      // Bar.qml:
      import QtQuick 1.0

      Item {
      property Text theText: myText
      Text

      { id: myText text: "foobar" }

      }

      // Foo.qml:
      import QtQuick 1.0

      Item {
      width: 800
      height: 600
      Bar

      { theText.text: "fixed" }

      }

      // The warning:
      file:///C:/cygwin/home/ryan/foo/Foo.qml:7: Cannot set properties on theText as it is null
      theText.text: "fixed"

      I would expect that Bar.theText would work automatically. However, I guess that all properties are processed before the rest of the code. In this situation, I would suggest that the declaration of theText provide a compiler warning. Also, please update the documentation (qml-extending-types.html#supported-property-types).

      Attachments

        For Gerrit Dashboard: QTBUG-20198
        # Subject Branch Project Status CR V

        Activity

          People

            denexter Andrew den Exter (closed Nokia identity) (Inactive)
            ryan@enzosystems.com Ryan van der Bijl
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes