qt - qml listview提高改变项目的速度

我有一个 ListView ,如何更改更改项目的速度,尝试了 highlightMoveSpeed(highlightMoveDuration),但这不起作用 有什么办法可以提高速度

slider.qml

import QtQuick 1.0

Rectangle {
id: slider
anchors.fill: parent

Component {
    id: pageDelegate

    Rectangle {
        id: page

        height: parent.height



        Component.onCompleted: page.width = slider.width

        Rectangle { 
            anchors.fill: parent
            // anchors.margins: 15

            Image{
                anchors.top: parent.top
                anchors.fill: parent
                source: modelData
            }   
        }
    }
}

ListView {
    id: list_model
    anchors.fill: parent
    model: modelData
    delegate: pageDelegate
    orientation: ListView.Horizontal
    snapMode: ListView.SnapToItem
    spacing: 5
    highlightMoveSpeed: 10000000
}

最佳答案

您可以使用默认突出显示并设置其速度,例如

highlightMoveDuration : 200
highlightMoveVelocity : 1000

或者,如果您使用自定义突出显示,则让突出显示组件处理该行为。例如

// Set the highlight delegate. Note we must also set highlightFollowsCurrentItem
// to false so the highlight delegate can control how the highlight is moved.
highlightFollowsCurrentItem: false
highlight: Rectangle {
    y: myListView.currentItem.y;
    Behavior on y {
        SmoothedAnimation {
            easing.type: Easing.Linear
            duration:200;
            maximumEasingTime:300
            velocity : 1000
        }
    }
}

检查 qt highlight example

https://stackoverflow.com/questions/17216207/

相关文章:

python - 从 Python 中的角度集生成多边形?

nginx - 如何替换 HTTP 请求 URI 中的特殊字符?

json - 将 JSON 数据加载到大查询中时出错 : flat value specified

macos - 运行 make 时如何修复 ranlib/libtool 错误

database - 是否有任何工具可以从数据库模式的 json 表示自动生成 ERD 图?

linux - 为什么我得到数据大小大于 mss 的数据包?

java - 创建 keystore 时出错 => 线程 "main"java.io.DataInp

python - 在 python 解释器和脚本文件中运行时的不同结果

css - 使用渐变生成饱和度/亮度蒙版

c++-cli - 导出 C++/CLI native 类 (C4679)