Changeset View
Changeset View
Standalone View
Standalone View
src/controls/private/SwipeItemEventFilter.qml
- This file was moved from src/controls/SplitDrawer.qml.
Show All 11 Lines | |||||
12 | * GNU Library General Public License for more details | 12 | * GNU Library General Public License for more details | ||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU Library General Public | 14 | * You should have received a copy of the GNU Library General Public | ||
15 | * License along with this program; if not, write to the | 15 | * License along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | 16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.1 | 20 | import QtQuick 2.5 | ||
21 | import "private" | 21 | import org.kde.kirigami 2.0 | ||
22 | import "templates" as T | | |||
23 | 22 | | |||
24 | /** | | |||
25 | * Split Drawers are used to expose additional UI elements which are optional | | |||
26 | * and can be used in conjunction with the main UI elements. | | |||
27 | * For example the Resource Browser uses a Split Drawer to select | | |||
28 | * different kinds of filters for the main view. | | |||
29 | */ | | |||
30 | T.SplitDrawer { | | |||
31 | id: root | | |||
32 | 23 | | |||
33 | background: Item { | 24 | MouseArea { | ||
34 | EdgeShadow { | 25 | id: swipeFilter | ||
35 | edge: Qt.RightEdge | | |||
36 | anchors { | 26 | anchors { | ||
37 | right: parent.left | 27 | right: parent.right | ||
38 | top: parent.top | 28 | top: parent.top | ||
39 | bottom: parent.bottom | 29 | bottom: parent.bottom | ||
40 | rightMargin: -1 | | |||
41 | } | | |||
42 | } | 30 | } | ||
31 | | ||||
32 | z: 99999 | ||||
33 | property Item currentItem | ||||
34 | property real peek | ||||
35 | | ||||
36 | width: Units.gridUnit | ||||
37 | onPositionChanged: { | ||||
38 | var mapped = mapToItem(parent.flickableItem.contentItem, mouse.x, mouse.y); | ||||
39 | currentItem = parent.flickableItem.itemAt(mapped.x, mapped.y) | ||||
40 | peek = 1 - mapped.x / parent.flickableItem.contentItem.width | ||||
43 | } | 41 | } | ||
44 | } | 42 | } | ||
45 | |