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 let PathView display ListElement by order
Forum Updated to NodeBB v4.3 + New Features

How to let PathView display ListElement by order

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 2.4k Views 1 Watching
  • 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.
  • S Offline
    S Offline
    sfjam
    wrote on last edited by
    #1

    i use a PathView to display picture,all pictures are from ListModel,but when it display,it does not
    by order which defined in ListModel

    1 Reply Last reply
    0
    • T Offline
      T Offline
      thisisbhaskar
      wrote on last edited by
      #2

      you mean..PathView does not display pictures in the order you gave in ListModel. It should display in the order you provide in ListModel. None of the *View models do sorting of Model before displaying.. Can you copy/paste the code???

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sfjam
        wrote on last edited by
        #3

        the code is downed from internet
        @import Qt 4.7

        Rectangle {
        width: 800; height: 420
        color: "black"

        ListModel {
            id: myModel
            ListElement { picName: "pics/1.png" }
            ListElement { picName: "pics/2.png" }
            ListElement { picName: "pics/3.png" }
            ListElement { picName: "pics/4.png" }
            ListElement { picName: "pics/5.png" }
            ListElement { picName: "pics/6.png" }
            ListElement { picName: "pics/7.png" }
            
        }
        
        Component {
            id: myDelegate
        
            Item{
                width: 340
                height: 260
                visible: PathView.onPath
                z: PathView.zOrder
        
        
                Image{
                    id:myImage
                    width: 340
                    height: 260
                    source: picName
                    anchors.horizontalCenter: parent.horizontalCenter
                    smooth: true
                }
                Image {
                    id: subImage
                    width: 340
                    height: 260
                    source: picName
                    anchors.horizontalCenter: parent.horizontalCenter
                    smooth: true
                    transform: Rotation { origin.x: 0; origin.y: 260; axis { x: 1; y: 0; z: 0 } angle: 180 }
                }
                Rectangle{
                    y: myImage.height;
                    x: -1
                    width: myImage.width + 1
                    height: myImage.height
                    gradient: Gradient {
                        GradientStop { position: 0.0; color: Qt.rgba(0,0,0, 0.7) }
                    }
                }
        
                transform:[
                    Rotation{
                        angle: PathView.rotateY
                        origin.x: 340/2
                        axis { x: 0; y: 1; z: 0 }
                    },
                    Scale {
                        xScale:PathView.scalePic; yScale:PathView.scalePic
                        origin.x: 340/2;   origin.y: 260/2
                    }
                ]
                MouseArea {
        
        
                    anchors.fill: parent
        
        
        
                    onClicked: view.currentIndex = index
        
        
        
                }
        
            }//Item
        }
        
        
        
        PathView {
            id: view
            focus: true
            model: myModel
            delegate: myDelegate
            anchors.fill: parent
            pathItemCount: 13
        
            preferredHighlightBegin: 0.5
            preferredHighlightEnd: 0.5
            highlightRangeMode: PathView.StrictlyEnforceRange
        
            flickDeceleration: 390
            path: myPath
        }
        
        Path {
            id: myPath
            startX: 0; startY: 150
            PathAttribute {name: "rotateY"; value: 50.0}
            PathAttribute {name: "scalePic"; value: 0.5}
            PathAttribute {name: "zOrder"; value: 1}
        
            PathLine{x:180; y: 150}
            PathPercent {value: 0.44}
            PathAttribute {name: "rotateY"; value: 50.0}
            PathAttribute {name: "scalePic"; value: 0.5}
            PathAttribute {name: "zOrder"; value: 10}
        
            PathQuad{x:320; y: 190; controlX: 290; controlY: 190}
            PathPercent {value: 0.50}
            PathAttribute {name: "rotateY"; value: 0.0}
            PathAttribute {name: "scalePic"; value: 1.0}
            PathAttribute {name: "zOrder"; value: 50}
        
            PathQuad{x:460; y: 150; controlX: 510; controlY: 150}
            PathPercent {value: 0.56}
            PathAttribute {name: "rotateY"; value: -50.0}
            PathAttribute {name: "scalePic"; value: 0.5}
            PathAttribute {name: "zOrder"; value: 10}
        
            PathLine{x:640; y: 150}
            PathPercent {value: 1.00}
            PathAttribute {name: "rotateY"; value: -50.0}
            PathAttribute {name: "scalePic"; value: 0.5}
            PathAttribute {name: "zOrder"; value: 1}
        }
        

        }

        @

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sfjam
          wrote on last edited by
          #4

          sorry i forget say this use click can display in order,but i want to use drag to implement the same function

          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