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

Make PathAttribute attributes compilable by qmlsc

XMLWordPrintable

      Notice that the custom ListElement fields below are compilable (via required properties), but the custom PathAttribute fields are not.

       

      Code

      Adapted from the official examples at https://doc.qt.io/qt-6/qml-qtquick-pathview.html and https://doc.qt.io/qt-6/qml-qtquick-pathattribute.html)

      import QtQuick
      
      Window {
          width: 640
          height: 480
          visible: true
      
          PathView {
              anchors.fill: parent
              model: ListModel {
                  ListElement {
                      name: "Bill Jones"
                      icon: "qtlogo.png"
                  }
                  ListElement {
                      name: "Jane Doe"
                      icon: "qtlogo.png"
                  }
                  ListElement {
                      name: "John Smith"
                      icon: "qtlogo.png"
                  }
              }
              delegate: Item {
                  id: element
      
                  required property url icon
                  required property string name
      
                  width: 80
                  height: 80
                  scale: PathView.iconScale
                  opacity: PathView.iconOpacity
                  Column {
                      Image {
                          anchors.horizontalCenter: nameText.horizontalCenter
                          width: 64
                          height: 64
                          source: element.icon
                      }
                      Text {
                          id: nameText
                          text: element.name
                          font.pointSize: 16
                      }
                  }
              }
              path: Path {
                  startX: 120; startY: 100
                  PathAttribute { name: "iconScale"; value: 1.0 }
                  PathAttribute { name: "iconOpacity"; value: 1.0 }
                  PathQuad { x: 120; y: 25; controlX: 260; controlY: 75 }
                  PathAttribute { name: "iconScale"; value: 0.3 }
                  PathAttribute { name: "iconOpacity"; value: 0.5 }
                  PathQuad { x: 120; y: 100; controlX: -20; controlY: 75 }
              }
          }
      }
      
      

       

      qmlsc output

      Warning: Main.qml:33:20: Member "iconScale" not found on type "QQuickPathView" [missing-property]
                  scale: PathView.iconScale
                                  ^^^^^^^^^
      Warning: Main.qml:33:20: Could not compile binding for scale: Cannot load property iconScale from QQuickPathViewAttached of QQuickPathViewAttached. [compiler]
                  scale: PathView.iconScale
                                  ^^^^^^^^^
      Warning: Main.qml:34:22: Member "iconOpacity" not found on type "QQuickPathView" [missing-property]
                  opacity: PathView.iconOpacity
                                    ^^^^^^^^^^^
      Warning: Main.qml:34:22: Could not compile binding for opacity: Cannot load property iconOpacity from QQuickPathViewAttached of QQuickPathViewAttached. [compiler]
                  opacity: PathView.iconOpacity
      

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

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            skoh-qt Sze Howe Koh
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes