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

There is no parent property in QtObject-based QML elements

    XMLWordPrintable

Details

    Description

      Parent item is integral part of QML, which essentially describes a dynamic object tree. Currently parent property is only accessible for visual QML elements inheriting from QGraphicsObject. Many non-visual QML elements in Qt Mobility QML bindings don't have parent property, making the developer experience inconsistent and unintuitive.

      Following code should work:

      import QtQuick 1.0
      
      Rectangle {
          width: 200; height: 300
          property string name: "Rectangle"
          QtObject {
              Component.onCompleted: {
                  console.log("Parent name is", parent.name)
              }
          }
      }
      

      Attachments

        Issue Links

          Activity

            People

              srutledg Shawn Rutledge
              jpetrell Joona Petrell
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: