Improved wheel mouse scrolling in FlowView.qml

This commit is contained in:
Luis Ángel San Martín 2016-04-09 18:52:12 +02:00
parent 6332b4f6e1
commit 874bc595e3

View File

@ -52,9 +52,13 @@ Rectangle {
MouseArea {
anchors.fill : list
onWheel: {
if(list.moving)
return;
var ci
if(wheel.angleDelta.y < 0) {
ci = Math.min(list.currentIndex+1, list.count);
ci = Math.min(list.currentIndex+1, list.count - 1);
}
else if(wheel.angleDelta.y > 0) {
ci = Math.max(0,list.currentIndex-1);
@ -86,6 +90,8 @@ Rectangle {
highlightRangeMode: ListView.StrictlyEnforceRange
preferredHighlightEnd: 50
highlightMoveDuration: 250
delegate: Component {
//cover
@ -168,11 +174,12 @@ Rectangle {
focus: true
Keys.onPressed: {
if (event.modifiers & Qt.ControlModifier || event.modifiers & Qt.ShiftModifier)
return;
var ci
if (event.key === Qt.Key_Right) {
ci = Math.min(list.currentIndex+1, list.count);
ci = Math.min(list.currentIndex+1, list.count - 1);
}
else if (event.key === Qt.Key_Left) {
ci = Math.max(0,list.currentIndex-1);