summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-07-21 00:55:13 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-28 07:31:11 -0700
commit413e4712448a005c30c323d2da1e0e5ef3640004 (patch)
tree1db03eb028a4eec67800fb00afb66aad48a82741 /mobile-widgets
parent18d910f6a72c07b58da4a042b21993b5b5d0fbbd (diff)
downloadsubsurface-413e4712448a005c30c323d2da1e0e5ef3640004.tar.gz
mapwidgetcontextmenu: rearrange some of the QML declarations
- move the readonly properties near the top of the root Item - move the rest of the properties bellow the readonly properties - make the ListView Timer as a child of the ListView - slight rename of the timer ID Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qml/MapWidgetContextMenu.qml63
1 files changed, 30 insertions, 33 deletions
diff --git a/mobile-widgets/qml/MapWidgetContextMenu.qml b/mobile-widgets/qml/MapWidgetContextMenu.qml
index 88c75491c..f2d224778 100644
--- a/mobile-widgets/qml/MapWidgetContextMenu.qml
+++ b/mobile-widgets/qml/MapWidgetContextMenu.qml
@@ -2,6 +2,27 @@
import QtQuick 2.7
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)") }
+ ]
+ readonly property real itemTextPadding: 10.0
+ readonly property real itemHeight: 30.0
+ readonly property int itemAnimationDuration: 100
+ readonly property color colorItemBackground: "#dedede"
+ readonly property color colorItemBackgroundSelected: "grey"
+ readonly property color colorItemText: "black"
+ readonly property color colorItemTextSelected: "#dedede"
+ readonly property color colorItemBorder: "black"
+ property int listViewIsVisible: -1
+ property real maxItemWidth: 0.0
+
Image {
id: contextMenuImage
x: -width
@@ -26,18 +47,6 @@ 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
@@ -47,16 +56,6 @@ Item {
}
}
- property real maxItemWidth: 0.0
- readonly property real itemTextPadding: 10.0
- readonly property real itemHeight: 30.0
- readonly property int itemAnimationDuration: 100
- readonly property color colorItemBackground: "#dedede"
- readonly property color colorItemBackgroundSelected: "grey"
- readonly property color colorItemText: "black"
- readonly property color colorItemTextSelected: "#dedede"
- readonly property color colorItemBorder: "black"
-
Component {
id: listItemDelegate
Rectangle {
@@ -80,8 +79,6 @@ Item {
}
}
- property int listViewIsVisible: -1
-
ListView {
id: listView
y: contextMenuImage.y + contextMenuImage.height + 10;
@@ -97,13 +94,21 @@ Item {
onVisibleChanged: listModel.selectedIdx = -1
onOpacityChanged: visible = opacity != 0.0
+ Timer {
+ id: timerListViewVisible
+ running: false
+ repeat: false
+ interval: itemAnimationDuration + 50
+ onTriggered: listViewIsVisible = 0
+ }
+
MouseArea {
anchors.fill: parent
onClicked: {
if (opacity < 1.0)
return;
listModel.selectedIdx = listView.indexAt(mouseX, mouseY)
- listViewVisibleTimer.restart()
+ timerListViewVisible.restart()
}
}
states: [
@@ -114,12 +119,4 @@ Item {
NumberAnimation { properties: "opacity"; easing.type: Easing.InOutQuad }
}
}
-
- Timer {
- id: listViewVisibleTimer
- running: false
- repeat: false
- interval: itemAnimationDuration + 50
- onTriggered: listViewIsVisible = 0
- }
}