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

qmlcompiler: Implement ability to deal with reparenting

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 6.2
    • Fix Version/s: 6.3
    • Component/s: QML: Compiler
    • Labels:

      Description

      We need to add the ability for qmlcompiler to handle dynamic reparenting. This can probably be done by adding the necessary information to qmltypes.

      Example where not handling dynamic reparenting (but instead using the document parent) leads to us not issuing a warning, even though we should:

      import QtQuick 2.15
      
      ListView {
        id: lv
        model: 1
        delegate: Text {
          text: parent.keyNavigationEnabled // this does not work
          // text: lv.keyNavigationEnabled // <-- this works
        }
      }
      

      The reverse case can be handled via an as cast (if the contentItem has a named type), but that's still unfortunate:

      ListView {
          contentItem: Rectangle {
              color: "red"
          }
          delegate: Text {
              color: NotQt.complimentaryColor((parent as Rectangle).color) // this as cast shouldn't be needed
          }
      }
      

        Attachments

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

          Activity

            People

            Assignee:
            qtqmlteam Qt Qml Team User
            Reporter:
            max.goldstein Maximilian Goldstein
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes