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

There is no parent property in QtObject-based QML elements

XMLWordPrintable

      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)
              }
          }
      }
      

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

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

              Created:
              Updated:

                There are no open Gerrit changes