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(); + } } diff --git a/src/qml/editorwidgets/relationeditors/ordered_relation_editor.qml b/src/qml/editorwidgets/relationeditors/ordered_relation_editor.qml index 1329ec4070..1afe2b2881 100644 --- a/src/qml/editorwidgets/relationeditors/ordered_relation_editor.qml +++ b/src/qml/editorwidgets/relationeditors/ordered_relation_editor.qml @@ -77,16 +77,14 @@ EditorWidgetBase { Text { visible: isEnabled color: Theme.secondaryTextColor - text: isEnabled && !constraintsHardValid ? qsTr('Ensure contraints') : '' + text: isEnabled && !constraintsHardValid ? qsTr('Ensure contraints are met') : '' anchors { leftMargin: 10 left: parent.left right: addButtonRow.left verticalCenter: parent.verticalCenter } - font.bold: true - font.italic: true - font.pointSize: Theme.tipFont.pointSize + font: Theme.tipFont } Row { @@ -106,7 +104,7 @@ EditorWidgetBase { round: false iconSource: Theme.getThemeVectorIcon('ic_add_white_24dp') - bgcolor: parent.enabled ? nmRelationId ? 'blue' : 'black' : 'grey' + bgcolor: parent.enabled ? 'black' : 'grey' } } diff --git a/src/qml/editorwidgets/relationeditors/relation_editor.qml b/src/qml/editorwidgets/relationeditors/relation_editor.qml index e82054edcc..03e74387a9 100644 --- a/src/qml/editorwidgets/relationeditors/relation_editor.qml +++ b/src/qml/editorwidgets/relationeditors/relation_editor.qml @@ -87,16 +87,14 @@ EditorWidgetBase { Text { visible: isEnabled color: Theme.secondaryTextColor - text: isEnabled && !constraintsHardValid ? qsTr('Ensure contraints') : '' + text: isEnabled && !constraintsHardValid ? qsTr('Ensure contraints are met') : '' anchors { leftMargin: 10 left: parent.left right: addButtonRow.left verticalCenter: parent.verticalCenter } - font.bold: true - font.italic: true - font.pointSize: Theme.tipFont.pointSize + font: Theme.tipFont } Row { @@ -116,7 +114,7 @@ EditorWidgetBase { round: false iconSource: Theme.getThemeVectorIcon('ic_add_white_24dp') - bgcolor: parent.enabled ? nmRelationId ? 'blue' : 'black' : 'grey' + bgcolor: parent.enabled ? 'black' : 'grey' } }