summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qml/MapWidgetContextMenu.qml33
1 files changed, 33 insertions, 0 deletions
diff --git a/mobile-widgets/qml/MapWidgetContextMenu.qml b/mobile-widgets/qml/MapWidgetContextMenu.qml
index 1c384d7d4..f40c192f9 100644
--- a/mobile-widgets/qml/MapWidgetContextMenu.qml
+++ b/mobile-widgets/qml/MapWidgetContextMenu.qml
@@ -45,4 +45,37 @@ Item {
append(menuItemData[i]);
}
}
+
+ 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 {
+ color: model.idx === listModel.selectedIdx ? colorItemBackgroundSelected : colorItemBackground
+ width: maxItemWidth
+ height: itemHeight
+ border.color: colorItemBorder
+ Text {
+ x: itemTextPadding
+ height: itemHeight
+ verticalAlignment: Text.AlignVCenter
+ text: model.itemText
+ color: model.idx === listModel.selectedIdx ? colorItemTextSelected : colorItemText
+ onWidthChanged: {
+ if (width + itemTextPadding * 2.0 > maxItemWidth)
+ maxItemWidth = width + itemTextPadding * 2.0
+ }
+ Behavior on color { ColorAnimation { duration: itemAnimationDuration }}
+ }
+ Behavior on color { ColorAnimation { duration: itemAnimationDuration }}
+ }
+ }
}