Kirigami2

SwipeItemEventFilter.qml
1 /*
2  * SPDX-FileCopyrightText: 2016 Marco Martin <[email protected]>
3  *
4  * SPDX-License-Identifier: LGPL-2.0-or-later
5  */
6 
7 import QtQuick 2.5
8 import org.kde.kirigami 2.4 as Kirigami
9 
10 
11 MouseArea {
12  id: swipeFilter
13  anchors {
14  right: parent.right
15  top: parent.top
16  bottom: parent.bottom
17  }
18 
19  z: 99999
20  property Item currentItem
21  property real peek
22 
23  preventStealing: true
24  width: Kirigami.Units.gridUnit
25  onPressed: mouse => {
26  const mapped = mapToItem(parent.flickableItem.contentItem, mouse.x, mouse.y);
27  currentItem = parent.flickableItem.itemAt(mapped.x, mapped.y);
28  }
29  onPositionChanged: mouse => {
30  const mapped = mapToItem(parent.flickableItem.contentItem, mouse.x, mouse.y);
31  currentItem = parent.flickableItem.itemAt(mapped.x, mapped.y);
32  peek = 1 - mapped.x / parent.flickableItem.contentItem.width;
33  }
34 }
QTextStream & right(QTextStream &stream)
QFuture< typename QtPrivate::MapResultType< void, MapFunctor >::ResultType > mapped(const Sequence &sequence, MapFunctor function)
QTextStream & right(QTextStream &s)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Feb 7 2023 04:14:24 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.