QML控件大全之QmloverFlow

QmloverFlow用于滚动浏览显示图片,效果如下

代码如下:CoverFlow.qml,FrmCoverFlow.qml,MyDelegate.qml

import QtQuick 2.0
import "./"
Rectangle {
    id: coverFlow
    color:"black"

    property ListModel model
    property int itemCount: 5

    PathView{
        id: pathView

        model: coverFlow.model
        delegate: MyDelegate{}

        path: coverFlowPath
        pathItemCount: coverFlow.itemCount
        anchors.fill: parent

        preferredHighlightBegin:0.5
        preferredHighlightEnd:0.5

    }

    Path{
        id: coverFlowPath
        startX: 0
        startY: coverFlow.height/3

        PathAttribute{ name:"iconZ"; value:0 }
        PathAttribute{ name:"iconAngle"; value:70 }
        PathAttribute{ name:"iconScale"; value: 0.6 }

        PathLine{ x:coverFlow.width*0.5; y:coverFlow.height/3; }
        PathAttribute{ name:"iconZ"; value:100 }
        PathAttribute{ name:"iconAngle"; value:0 }
        PathAttribute{ name:"iconScale"; value:1.0 }

        PathLine{ x: coverFlow.width; y:coverFlow.height/3 }
        PathAttribute{ name:"iconZ"; value: 0 }
        PathAttribute{ name:"iconAngle"; value:-70 }
        PathAttribute{ name:"iconScale"; value:0.6 }
        PathPercent{ value: 1.0 }
    }
}

import QtQuick 2.5
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4

Item {
    id: root
    visible: true
    width: 640
    height: 480
    ListModel{
        id: model
        ListElement{url:"./images/01.jpg"}
        ListElement{url:"./images/02.png"}
        ListElement{url:"./images/03.jpg"}
        ListElement{url:"./images/04.jpg"}
        ListElement{url:"./images/05.jpg"}
    }
    Rectangle{
        id: zhanwei
        anchors.left: parent.left
        width: root.width
        height: root.height/5
        visible:false
    }

    /*预计用来显示景区信息*/
    CoverFlow{
        id: coverFlow
        anchors.left: parent.left
        anchors.top: zhanwei.bottom
        anchors.topMargin: 10
        anchors.right: parent.right
        width: root.width
        height: root.height*2/5
        visible: true

        model:model
    }
}

import QtQuick 2.0

Item {
    id: delegateItem
    width: 320
    height: 450
    z: PathView.iconZ
    scale: PathView.iconScale

    Image{
        id: dlgImg
        source: url
        width:delegateItem.width
        height:delegateItem.height
    }
    transform:Rotation{
        origin.x: dlgImg.width/2.0
        origin.y: dlgImg.height/2.0
           axis{ x:0; y:1; z:0 }
        angle:delegateItem.PathView.iconAngle
    }
}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

vqt5_qt6

你的鼓励是我们创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值