Qt 用于鼠标滚轮的QML滚动条/列表视图灵敏度。如何调整
有QML控制滚动条,鼠标滚轮滚动列表快,我需要执行这个较慢。哪些属性可用于此目的 Qt 5.9 这来自一个示例(来自Qt kit的rssnews示例项目): 我认为这是因为:Qt 用于鼠标滚轮的QML滚动条/列表视图灵敏度。如何调整,qt,qml,qtquick2,qt5.9,Qt,Qml,Qtquick2,Qt5.9,有QML控制滚动条,鼠标滚轮滚动列表快,我需要执行这个较慢。哪些属性可用于此目的 Qt 5.9 这来自一个示例(来自Qt kit的rssnews示例项目): 我认为这是因为: 但是找不到我的案例的scrollSpeed属性…我不认为滚动条是让事情变得疯狂的原因。Flickable是ListView的基类 这里有一个属性:maximumFlickVelocity,以像素/秒为单位 尝试将其设置为适当的值 这也会影响flicking行为 如果是滚动条,您可以尝试以下属性:步长-将其设置为小于0.1的
但是找不到我的案例的scrollSpeed属性…我不认为
滚动条是让事情变得疯狂的原因。Flickable
是ListView
的基类
这里有一个属性:maximumFlickVelocity
,以像素/秒为单位
尝试将其设置为适当的值
这也会影响flicking行为
如果是滚动条
,您可以尝试以下属性:步长
-将其设置为小于0.1的值。我没有Qt5.9,所以我不能尝试。我不相信这就是原因
在最坏的情况下,层aMouseArea
ontop的整个东西,它不接受任何按钮,但处理onWheel
:
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.NoButton
//onWheel: manage the scrolling yourself, here.
}
在ListView顶部包装一个MouseArea(如derM所述)是我的解决方案。现在ListView在鼠标滚轮上做出反应
MouseArea {
anchors.fill: parent
ListView {
id: lv
anchors.fill: parent
delegate: ...
ScrollBar.vertical: ScrollBar {
parent: lv.parent
anchors.top: lv.top
anchors.left: lv.right
anchors.bottom: lv.bottom
}
}
}
请添加一些代码,如果您不知道要尝试什么,请至少添加一些示例代码,我们可以在这些代码上尝试。还请添加有关您使用的qt版本的信息。还有更多特定的标记,如qt5.6、qt5.7 e.t.c。您是否计划使用滚动条的自定义示例实现,而不是使用QtQuick.Controls 2.x
中的滚动条?
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.NoButton
//onWheel: manage the scrolling yourself, here.
}
MouseArea {
anchors.fill: parent
ListView {
id: lv
anchors.fill: parent
delegate: ...
ScrollBar.vertical: ScrollBar {
parent: lv.parent
anchors.top: lv.top
anchors.left: lv.right
anchors.bottom: lv.bottom
}
}
}