From 020f23717f07bd5a4c5ef246c42bc107cb420983 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Tue, 12 Nov 2024 09:04:35 +0700 Subject: [PATCH] Fix geometry digitizing step missing when adding a relationship parent via the relation combobox --- src/qml/RelationCombobox.qml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/qml/RelationCombobox.qml b/src/qml/RelationCombobox.qml index a97e9e6e74..8d864ef229 100644 --- a/src/qml/RelationCombobox.qml +++ b/src/qml/RelationCombobox.qml @@ -614,9 +614,11 @@ Item { visible: enabled && allowAddFeature && relation !== undefined && relation.isValid onClicked: { - embeddedPopup.state = 'Add'; - embeddedPopup.currentLayer = relationCombobox.relation ? relationCombobox.relation.referencedLayer : null; - embeddedPopup.open(); + if (relationCombobox.relation.referencedLayer.geometryType() !== Qgis.GeometryType.Null) { + requestGeometry(relationCombobox, relationCombobox.relation.referencedLayer); + return; + } + showAddFeaturePopup(); } } @@ -646,4 +648,17 @@ Item { } } } + + function requestedGeometryReceived(geometry) { + showAddFeaturePopup(geometry); + } + + function showAddFeaturePopup(geometry) { + embeddedPopup.state = 'Add'; + embeddedPopup.currentLayer = relationCombobox.relation ? relationCombobox.relation.referencedLayer : null; + if (geometry !== undefined) { + embeddedPopup.applyGeometry(geometry); + } + embeddedPopup.open(); + } }