summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-07-20 19:30:34 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-28 07:31:11 -0700
commiteeb53e965e49f84a21b975fbcba7e12409b074ea (patch)
treeace4b07a703cddeab6a65e044f7fc8558fd27b2a /mobile-widgets
parent7dfb168f7fd2b9d32c4296e2aab15ef87a79f31a (diff)
downloadsubsurface-eeb53e965e49f84a21b975fbcba7e12409b074ea.tar.gz
mapwidgetcontextmenu: create a ListModel for the context menu
Menu item indexes are enumerated in the object menuItemIndex, while menuItemData, holds an array of objects which will define the number of items, with indexes (idx) and text (itemText). When the ListModel is created, it's dynamically populated from from menuItemData. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qml/MapWidgetContextMenu.qml21
1 files changed, 21 insertions, 0 deletions
diff --git a/mobile-widgets/qml/MapWidgetContextMenu.qml b/mobile-widgets/qml/MapWidgetContextMenu.qml
index f2ab27f79..1c384d7d4 100644
--- a/mobile-widgets/qml/MapWidgetContextMenu.qml
+++ b/mobile-widgets/qml/MapWidgetContextMenu.qml
@@ -24,4 +24,25 @@ Item {
}
}
}
+
+ 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]);
+ }
+ }
}