From f4844be9d364f484b87e29a45b31e3db504aa968 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Tue, 12 Nov 2024 09:04:35 +0700 Subject: [PATCH 1/2] 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 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(); + } } From 39974de79ba9ba88bcbf4005e21e60c1866bcccf Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Tue, 12 Nov 2024 09:08:48 +0700 Subject: [PATCH 2/2] Remove out-of-palette use of blue color, improve constraints label --- .../relationeditors/ordered_relation_editor.qml | 8 +++----- src/qml/editorwidgets/relationeditors/relation_editor.qml | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) 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' } }