summaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qml/MapWidgetContextMenu.qml
blob: 1c384d7d4b528dfa55755716810bcea38dba513a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// SPDX-License-Identifier: GPL-2.0
import QtQuick 2.7

Item {
	Image {
		id: contextMenuImage
		x: -width
		source: "qrc:///mapwidget-context-menu"

		SequentialAnimation {
			id:contextMenuImageAnimation
			PropertyAnimation {
				target: contextMenuImage; property: "scale"; from: 1.0; to: 0.8; duration: 80;
			}
			PropertyAnimation {
				target: contextMenuImage; property: "scale"; from: 0.8; to: 1.0; duration: 60;
			}
		}

		MouseArea {
			anchors.fill: parent
			onClicked: {
				contextMenuImageAnimation.restart()
			}
		}
	}

	readonly property var menuItemIndex: {
		"OPEN_LOCATION_IN_GOOGLE_MAPS": 0,
		"COPY_LOCATION_DECIMAL":        1,
		"COPY_LOCATION_SEXAGESIMAL":    2
	}

	readonly property var menuItemData: [
		{ idx: menuItemIndex.OPEN_LOCATION_IN_GOOGLE_MAPS, itemText: qsTr("Open location in Google Maps") },
		{ idx: menuItemIndex.COPY_LOCATION_DECIMAL,        itemText: qsTr("Copy location to clipboard (decimal)") },
		{ idx: menuItemIndex.COPY_LOCATION_SEXAGESIMAL,    itemText: qsTr("Copy location to clipboard (sexagesimal)") }
	]

	ListModel {
		id: listModel
		property int selectedIdx: -1
		Component.onCompleted: {
			for (var i = 0; i < menuItemData.length; i++)
				append(menuItemData[i]);
		}
	}
}