Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to use PathAttribute as Rotation angle?
QtWS25 Last Chance

How to use PathAttribute as Rotation angle?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 1.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yongsungkim
    wrote on last edited by A Former User
    #1

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

    }
    @

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kshahim
      wrote on last edited by
      #2

      Use this:

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

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved