diff --git a/src/qml/RelationCombobox.qml b/src/qml/RelationCombobox.qml index 6a001d3eab..fc8745378e 100644 --- a/src/qml/RelationCombobox.qml +++ b/src/qml/RelationCombobox.qml @@ -611,9 +611,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(); } } @@ -643,4 +645,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 de0f9ba6dc..a6e37b778a 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 f910ac4631..0d3c993b7e 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' } }