niepangu 2022-04-21 14:19 采纳率: 37.5%
浏览 120
已结题

QML 的ListView 有办法修改滑动的速度吗?

一个非常简单的ListView的例子

import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import QtQuick.Window 2.2

Window {
visible: true
width: 300
height: 450
title: qsTr("Hello World")

ListView{
    id:listView
    anchors.fill: parent
    width: 300
    height:45
    model: 20

    highlightFollowsCurrentItem:true
    highlightMoveVelocity:80
    snapMode: ListView.SnapOneItem

    delegate: Rectangle{
          width: listView.width /3
          height: listView.height  /4
          color: index%2 ? "red":"yellow"
          Label{
              anchors.centerIn: parent
              font.pointSize: 10
              text: index
          }
    }
}

}

网上说可以通过highlightMoveVelocity控制滑动的速度哦,但是我试了一下不行呀,怎么才能改变滑动的速度?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 4月29日
    • 创建了问题 4月21日