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(); + } }