Qml 模型-视图-代理(贰)之 路径视图(PathView) 学习
效果图
import QtQuick 2.15
Item {
height: 500
width: 300
Rectangle{
id: root
width: parent.width
height: parent.height
color: "white"
PathView{
anchors.fill: parent
model: 100
delegate: flipCardDelegate
path: Path{
startX: root.width/2
startY: 0
PathAttribute{name: "itemZ"; value: 0;}
PathAttribute{name: "itemAngle"; value:-90; }
PathAttribute{name: "itemScale"; value: 0.5;}
PathLine{
x: root.width/2;y: root.height*0.4;
}
PathPercent { value: 0.48; }
PathLine { x: root.width/2; y: root.height*0.5; }
PathAttribute { name: "itemAngle"; value: 0.0; }
PathAttribute { name: "itemScale"; value: 1.0; }
PathAttribute { name: "itemZ"; value: 100 }
PathLine { x: root.width/2; y: root.height*0.6; }
PathPercent { value: 0.52; }
PathLine { x: root.width/2; y: root.height; }
PathAttribute { name: "itemAngle"; value: 90.0; }
PathAttribute { name: "itemScale"; value: 0.5; }
PathAttribute { name: "itemZ"; value: 0 }
}
pathItemCount: 16
preferredHighlightBegin: 0.5
preferredHighlightEnd: 0.5
}
Component {
id: flipCardDelegate
Item {
id: wrapper
width: 64
height: 64
visible: PathView.onPath
scale: PathView.itemScale
z: PathView.itemZ
property variant rotX: PathView.itemAngle
transform: Rotation { axis { x: 1; y: 0; z: 0 } angle: wrapper.rotX; origin { x: 32; y: 32; } }
Rectangle {
anchors.fill: parent
color: "lightGray"
border.color: "black"
border.width: 3
}
Text {
anchors.centerIn: parent
text: index
font.pixelSize: 30
}
}
}
}
}
原文地址:https://blog.csdn.net/qq_41722795/article/details/143890269
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!