【问题标题】:Pathview Issue in QMLQML 中的路径视图问题
【发布时间】:2012-11-26 10:32:52
【问题描述】:

我正在设计 Spinner 控件(或 You can Scollable 项目列表)。就功能而言,它的工作正常

主要问题是我想在滚动项目时创造一种圆周运动的感觉。所以为了在滚动列表中产生这种效果,我们决定让前后项的大小比当前项小

我真的很难获得不同尺寸的物品。任何人都可以建议我如何进行相同的操作。

下面是我的代码sn-p

ContentModel.qml

import QtQuick 1.1

Rectangle {
    property alias model: view.model
    property alias delegate: view.delegate
    property real itemHeight: height/5

    clip: true

    PathView {
        id: view
        anchors.fill: parent
        //number of items visible on the path at any one time.
        pathItemCount: height/itemHeight
        // Ensuring the selected componenet to be at the center
        preferredHighlightBegin: 0.5
        preferredHighlightEnd: 0.5

        // select maximum distance from the path that initiate mouse dragging
        dragMargin: view.width


        //Declare the path of list
        path: Path {
            startX: view.width/2; startY: -itemHeight/2
            PathLine { x: view.width/2; y: view.pathItemCount*itemHeight + itemHeight/.8}
        }
    }
}

main.qml sn -p

main.qml

.......
ContentModel{
      id: ContentModel_spinner
      width: ContentModel_scroll.width; height: ContentModel_scroll.height
      focus: true
      model: 20
      delegate: Text { font.pixelSize: index === ContentModel_spinner.currentIndex  ?  sec_spinner.height/4 : ContentModel_spinner.height/4.5; text: formatindex(index); height: ContentModel_scroll.height }
            }

【问题讨论】:

    标签: qt qml qt-quick


    【解决方案1】:

    查看教程here。他们给出了不同形状路径视图的示例。

    【讨论】:

      猜你喜欢
      • 2011-02-18
      • 1970-01-01
      • 1970-01-01
      • 2011-09-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-10
      相关资源
      最近更新 更多