summaryrefslogtreecommitdiffstats
path: root/framework/qml/ListView.qml
diff options
context:
space:
mode:
Diffstat (limited to 'framework/qml/ListView.qml')
-rw-r--r--framework/qml/ListView.qml51
1 files changed, 51 insertions, 0 deletions
diff --git a/framework/qml/ListView.qml b/framework/qml/ListView.qml
new file mode 100644
index 00000000..7fbb5721
--- /dev/null
+++ b/framework/qml/ListView.qml
@@ -0,0 +1,51 @@
1/*
2 * Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net>
3 * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsystems.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20import QtQuick 2.7
21import QtQuick.Controls 2
22
23ListView {
24 id: root
25 property var focusProxy: root
26
27 /*
28 * The MouseArea + interactive: false + maximumFlickVelocity are required
29 * to fix scrolling for desktop systems where we don't want flicking behaviour.
30 *
31 * See also:
32 * ScrollView.qml in qtquickcontrols
33 * qquickwheelarea.cpp in qtquickcontrols
34 */
35 MouseArea {
36 anchors.fill: root
37 propagateComposedEvents: true
38
39 onWheel: {
40 //Some trackpads (mine) emit 0 events in between that we can safely ignore.
41 if (wheel.angleDelta.y) {
42 listView.flick(0, wheel.angleDelta.y * 40)
43 }
44 }
45 }
46 interactive: false
47 maximumFlickVelocity: 100000
48
49 boundsBehavior: Flickable.StopAtBounds
50}
51