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

AnchorChanges uses QQmlScriptString

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.4.1
    • None

    Description

      Bindings on properties of type QQmlScriptString cannot be compiled to C++ because they are untyped. We need a solution that involves a typed property there. The following snippet of QML produces warnings when compiled to C++:

      import QtQuick
      
      Window {
          id: root
          width: 640
          height: 480
          visible: true
          title: "Foo"
      
          Text {
              id: label
      
              states: [
                  State {
                      when: true
                      AnchorChanges {
                         target: item
                         anchors.top: label.bottom
                      }
                  }
              ]
      
              anchors.top: parent.top
          }
      
          Item {
              id: item
          }
      } 

      The warning:

       Warning: main.qml:18:33: Cannot assign binding of type QQuickAnchorLine to QQmlScriptString
                         anchors.top: label.bottom
                                      ^^^^^^^^^^^^
      Error: main.qml:18:45: Could not compile binding for top: cannot convert from QQuickAnchorLine of QQuickItem::bottom with type QQuickAnchorLine to QQmlScriptString of QQmlScriptString

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              ulherman Ulf Hermann
              Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes