Kirigami2

SwipeItemEventFilter.qml
1/*
2 * SPDX-FileCopyrightText: 2016 Marco Martin <mart@kde.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7import QtQuick
8import org.kde.kirigami as Kirigami
9
10
11MouseArea {
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}
QFuture< QtPrivate::MapResultType< Iterator, MapFunctor > > mapped(Iterator begin, Iterator end, MapFunctor &&function)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:52 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.