diff --git a/app/qml/map/MMRecordingTools.qml b/app/qml/map/MMRecordingTools.qml index 507fd4012..3e6431fcb 100644 --- a/app/qml/map/MMRecordingTools.qml +++ b/app/qml/map/MMRecordingTools.qml @@ -175,7 +175,7 @@ Item { accuracyRingSize: positionMarkerComponent.accuracyRingSize } - MMDataCrosshair { + MMCrosshair { //labeled crosshair id: crosshair anchors.fill: parent @@ -185,6 +185,8 @@ Item { qgsProject: __activeProject.qgsProject mapSettings: root.map.mapSettings shouldUseSnapping: !mapTool.isUsingPosition + hasLabel: true + crosshairLabelText: "58.4 m" } MMToolbar { diff --git a/app/qml/map/components/MMCrosshair.qml b/app/qml/map/components/MMCrosshair.qml index a9c7ec465..8ae283ee1 100644 --- a/app/qml/map/components/MMCrosshair.qml +++ b/app/qml/map/components/MMCrosshair.qml @@ -19,6 +19,9 @@ Item { /*required*/ property var mapSettings property bool shouldUseSnapping: false + property bool hasLabel: false + property string crosshairLabelText: "" + property point center: Qt.point( root.width / 2, root.height / 2 ) property var recordPoint: snapUtils.recordPoint @@ -39,6 +42,14 @@ Item { } + Loader { + id: crosshairLabelLoader + active: root.hasLabel + sourceComponent: crosshairLabelComponent + anchors.top: crosshairForeground.bottom + anchors.horizontalCenter: crosshairForeground.horizontalCenter + } + Image { id: crosshairBackground // white background of the crosshair @@ -237,6 +248,20 @@ Item { source: __style.crosshairCircleImage } + Component { + id: crosshairLabelComponent + + MMMapLabel { + bgColor: __style.forestColor + textColor: __style.polarColor + textBgColorInverted: false + hasIcon: false + text: root.crosshairLabelText + + onClicked: console.log( "MapLabel" ) + } + } + Connections { target: __activeProject diff --git a/app/qml/map/components/MMDataCrosshair.qml b/app/qml/map/components/MMDataCrosshair.qml index ee3e5036c..9e59f3eaf 100644 --- a/app/qml/map/components/MMDataCrosshair.qml +++ b/app/qml/map/components/MMDataCrosshair.qml @@ -273,21 +273,10 @@ Item { } MMMapLabel { - // Rectangle { - // anchors.fill: parent - // color: "lightgoldenrodyellow" - // } - - //height:50 - //width: 70 - visible: true //root.state !== "inactive" && root.isStreaming - //iconSource: __style.streamingIcon - - maxWidth: crosshairForeground.width + 6 * __dp bgColor: __style.forestColor textColor: __style.polarColor textBgColorInverted: false - + hasIcon: false text: qsTr( "Test" ) anchors.top: crosshairForeground.bottom diff --git a/app/qml/map/components/MMMapLabel.qml b/app/qml/map/components/MMMapLabel.qml index ac58adf96..72a67365b 100644 --- a/app/qml/map/components/MMMapLabel.qml +++ b/app/qml/map/components/MMMapLabel.qml @@ -28,6 +28,7 @@ Item { property color bgColor: __style.positiveColor property color textColor: __style.forestColor property bool textBgColorInverted: false + property bool hasIcon: true Rectangle { width: row.width @@ -52,8 +53,7 @@ Item { anchors.verticalCenter: parent.verticalCenter source: control.iconSource ? control.iconSource : "" color: control.textColor - size: __style.icon24 - visible: control.iconSource ? true : false + size: control.hasIcon ? __style.icon24 : 0 } Rectangle {