How to use PathAttribute as Rotation angle?



  • I write a code as following in PathView.qml. But 'rotation' as pathattribute is not applied.
    I tried to search a solution for this problem. But the solution can not be found.

    error :
    file:///C:/Users/yongsung85.kim/Desktop/Workspace/PathView/PathView.qml:73: Unable to assign [undefined] to double

    Why not available onlay pathattribute 'rotation' in transform Rotation?

    PathView.qml
    @
    import QtQuick 2.0
    Rectangle {
    width: 360
    height: 360

    ListModel {
        id: list
        ListElement {name: "a"; icon: "1.png"}
        ListElement {name: "b";icon: "2.png"}
        ListElement {name: "c";icon: "3.png"}
        ListElement {name: "d";icon: "4.png"}
        ListElement {name: "e"; icon: "4.png"}
        ListElement {name: "f"; icon: "5.png"}
        ListElement {name: "g"; icon: "6.png"}
    }
    
    
    Component {
        id: appDelegate
    
        Item {
            width: parent.width/2
            height: parent.height/2
            scale: PathView.iconScale
            z: PathView.height
    
            Image {
                anchors.horizontalCenter: parent.horizontalCenter
                source: icon
                width:  parent.width
                height: parent.height
                smooth: false
            }
            transform: Rotation {
                origin.x :width/2
                origin.y :height/2
                axis {
                    x: 0
                    y: 1
                    z: 0
                }
                angle: PathView.rotation
            }
        }
    }
    
    
    PathView {
        id: view
        anchors.fill: parent
        focus: true
        model: list
        delegate : appDelegate
        pathItemCount: 3
        interactive: true
        highlightMoveDuration: 100
        preferredHighlightBegin: 0.5
        preferredHighlightEnd: 0.5
        property int xcenter: Math.round( parent.width/2 )
        property int ycenter: Math.round( parent.height/2 )
        property int xsize: parent.width
    
    
        path: Path {
            startX: 0
            startY: view.ycenter
            PathAttribute { name: "iconScale"; value: 0.2 }
            PathAttribute { name: "rotation"; value: 90 }
            PathAttribute { name: "height"; value: -10 }
            PathLine { x: view.xcenter; y: view.ycenter }
            PathAttribute { name: "iconScale"; value: 1.0 }
            PathAttribute { name: "rotation"; value: 0 }
            PathAttribute { name: "height"; value: 0 }
            PathLine { x: view.xsize; y: view.ycenter }
            PathAttribute { name: "iconScale"; value: 0.2 }
            PathAttribute { name: "rotation"; value: -90 }
            PathAttribute { name: "height"; value: -10 }
        }
    
    }
    

    }
    @



  • Use this:

        transform: Rotation {
            origin.x :width/2
            origin.y :height/2
            axis {
                x: 0
                y: 1
                z: 0
            }
            angle: appDelegate.PathView.rotation   <<-----
        }

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.