list滚动条Scroll 偏移和长度计算公式总结
A.计算偏移:
偏移/list窗口高度 = 目前总偏移/所有listitem高度总和
即:
偏移 = (目前总偏移 * list窗口高度 ) / 所有listitem高度总和
B.计算Scroll拇指高度
所有listitem高度总和 / list窗口高度 = pageCnt
Scroll拇指高度 = list窗口高度 / pageCnt
即:
Scroll拇指高度 = (list窗口高度 * list窗口高度) / 所有listitem高度总和
转载:https://blog.csdn.net/guoquan2003/article/details/6163277
对于qml,有个类叫做ScrollBar
import QtQuick 2.9 import QtQuick.Window 2.2 import QtQuick.Controls 2.3 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Rectangle { id: frame clip: </