From d6fd14cdd7de4e3277a2f5e94374f2fe7bfcb0e8 Mon Sep 17 00:00:00 2001 From: Martin Kolman Date: Sat, 23 Jan 2021 22:47:14 +0100 Subject: [PATCH] Make it possible to remove individual map overlays Map it possible to remove individual map overlays on the map overlay page by adding an "x" button next to the opacity slider. As this make the "remove" button kinda redundant repurpose it for a quick return to map shortcut. --- .../gui_modules/gui_qt5/qml/MapLayersPage.qml | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/modules/gui_modules/gui_qt5/qml/MapLayersPage.qml b/modules/gui_modules/gui_qt5/qml/MapLayersPage.qml index 9dacb795..c52294c1 100644 --- a/modules/gui_modules/gui_qt5/qml/MapLayersPage.qml +++ b/modules/gui_modules/gui_qt5/qml/MapLayersPage.qml @@ -74,9 +74,25 @@ BasePage { id : sliderWrapper width : lGrid.cellWidth height : opacitySlider.height + TextButton { + id : removeLayerButton + width : 64 * rWin.c.style.m + anchors.right : parent.right + height : parent.height + text : "❌" + visible : index != 0 + + onClicked : { + rWin.log.info("removing layer " + index) + rWin.mapPage.removeMapLayerByIndex(index) + } + + + + } Slider { id : opacitySlider - width : lGrid.cellWidth + width : lGrid.cellWidth - removeLayerButton.width anchors.verticalCenter : parent.verticalCenter stepSize : 0.1 maximumValue : 1.0 @@ -118,11 +134,11 @@ BasePage { width : actionGrid.cellWidth height : isLastItem ? lGrid.height : 0 visible : layersLW.model.count > 1 - text : qsTr("remove") + text : qsTr("back to map") onClicked : { - rWin.log.info("remove layer") - // remove the last layer - rWin.mapPage.removeMapLayerByIndex(layersLW.model.count - 1) + rWin.log.info("back to map from map overlays page") + // go back to the map page + rWin.push(null, !rWin.animate) } } }