From c6da7c6ced2b9459fa03a1620e0a710ef9fd07bf Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Fri, 31 Jan 2025 09:53:04 +0700 Subject: [PATCH 1/2] Do not break currentFormFeature property binding --- src/core/featurelistmodel.cpp | 2 ++ src/qml/editorwidgets/ValueRelation.qml | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/core/featurelistmodel.cpp b/src/core/featurelistmodel.cpp index b58632b091..061840cde9 100644 --- a/src/core/featurelistmodel.cpp +++ b/src/core/featurelistmodel.cpp @@ -514,7 +514,9 @@ void FeatureListModel::setCurrentFormFeature( const QgsFeature &feature ) mCurrentFormFeature = feature; if ( !mFilterExpression.isEmpty() && QgsValueRelationFieldFormatter::expressionRequiresFormScope( mFilterExpression ) ) + { reloadLayer(); + } emit currentFormFeatureChanged(); } diff --git a/src/qml/editorwidgets/ValueRelation.qml b/src/qml/editorwidgets/ValueRelation.qml index 04e61c9ed3..d1b512cbff 100644 --- a/src/qml/editorwidgets/ValueRelation.qml +++ b/src/qml/editorwidgets/ValueRelation.qml @@ -170,8 +170,4 @@ EditorWidgetBase { } } } - - function siblingValueChanged(field, feature) { - listModel.currentFormFeature = feature; - } } From 2870c0b4d75d90fd2f441a5ffdc99d626e52f39c Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Fri, 31 Jan 2025 11:40:17 +0700 Subject: [PATCH 2/2] Fix lack of multiline handling in the relation editor widgets --- .../ordered_relation_editor.qml | 35 +++++++++++-------- .../relationeditors/relation_editor.qml | 15 +++++--- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/src/qml/editorwidgets/relationeditors/ordered_relation_editor.qml b/src/qml/editorwidgets/relationeditors/ordered_relation_editor.qml index 025e495312..07e7b18151 100644 --- a/src/qml/editorwidgets/relationeditors/ordered_relation_editor.qml +++ b/src/qml/editorwidgets/relationeditors/ordered_relation_editor.qml @@ -13,7 +13,7 @@ import ".." EditorWidgetBase { id: relationEditor - property int itemHeight: 40 + property int itemHeight: 48 // because no additional addEntry item on readOnly (isEnabled false) height: listView.contentHeight + (isEnabled ? addEntry.height : 0) @@ -250,27 +250,31 @@ EditorWidgetBase { Image { id: featureImage source: ImagePath ? UrlUtils.fromString(ImagePath) : Theme.getThemeVectorIcon("ic_photo_notavailable_black_24dp") - width: parent.height - height: parent.height + anchors.verticalCenter: parent.verticalCenter + width: 48 + height: 48 fillMode: Image.PreserveAspectFit visible: !!ImagePath } Text { id: featureText + anchors.verticalCenter: parent.verticalCenter + width: parent.width - 8 - (featureImage.visible ? featureImage.width : 0) - viewButton.width - moveDownButton.width - moveUpButton.width - deleteButton.width + topPadding: 5 + bottomPadding: 5 font: Theme.defaultFont color: !isEnabled ? Theme.mainTextDisabledColor : Theme.mainTextColor text: Description || model.displayString - verticalAlignment: Text.AlignVCenter - padding: 4 elide: Text.ElideRight - width: parent.width - 8 - (featureImage.visible ? featureImage.width : 0) - viewButton.width - moveDownButton.width - moveUpButton.width - deleteButton.width + wrapMode: Text.WordWrap } QfToolButton { id: viewButton - width: 40 - height: 40 + anchors.verticalCenter: parent.verticalCenter + width: 48 + height: 48 round: false iconSource: isEnabled ? Theme.getThemeVectorIcon('ic_edit_attributes_white_24dp') : Theme.getThemeVectorIcon('ic_baseline-list_white_24dp') @@ -290,9 +294,10 @@ EditorWidgetBase { QfToolButton { id: moveDownButton + anchors.verticalCenter: parent.verticalCenter visible: isEnabled - width: visible ? 40 : 0 - height: 40 + width: visible ? 48 : 0 + height: 48 opacity: (index === listView.count - 1) ? 0.3 : 1 round: false @@ -310,9 +315,10 @@ EditorWidgetBase { QfToolButton { id: moveUpButton + anchors.verticalCenter: parent.verticalCenter visible: isEnabled - width: visible ? 40 : 0 - height: 40 + width: visible ? 48 : 0 + height: 48 opacity: (index === 0) ? 0.3 : 1 round: false @@ -330,9 +336,10 @@ EditorWidgetBase { QfToolButton { id: deleteButton + anchors.verticalCenter: parent.verticalCenter visible: isEnabled - width: visible ? 40 : 0 - height: 40 + width: visible ? 48 : 0 + height: 48 round: false iconSource: Theme.getThemeVectorIcon('ic_delete_forever_white_24dp') diff --git a/src/qml/editorwidgets/relationeditors/relation_editor.qml b/src/qml/editorwidgets/relationeditors/relation_editor.qml index 902a7396c2..8cb07f4877 100644 --- a/src/qml/editorwidgets/relationeditors/relation_editor.qml +++ b/src/qml/editorwidgets/relationeditors/relation_editor.qml @@ -12,7 +12,7 @@ import ".." EditorWidgetBase { id: relationEditor - property int itemHeight: 40 + property int itemHeight: 48 property int bottomMargin: 10 property int maximumVisibleItems: 4 @@ -229,16 +229,20 @@ EditorWidgetBase { id: featureText anchors.verticalCenter: parent.verticalCenter width: parent.width - viewButton.width - deleteButton.width + topPadding: 5 + bottomPadding: 5 font: Theme.defaultFont color: !isEnabled ? Theme.mainTextDisabledColor : Theme.mainTextColor elide: Text.ElideRight + wrapMode: Text.WordWrap text: nmRelationId ? model.nmDisplayString : model.displayString } QfToolButton { id: viewButton - width: 40 - height: 40 + anchors.verticalCenter: parent.verticalCenter + width: 48 + height: 48 round: false iconSource: isEnabled ? Theme.getThemeVectorIcon('ic_edit_attributes_white_24dp') : Theme.getThemeVectorIcon('ic_baseline-list_white_24dp') @@ -257,9 +261,10 @@ EditorWidgetBase { QfToolButton { id: deleteButton + anchors.verticalCenter: parent.verticalCenter visible: isEnabled && isButtonEnabled('DeleteChildFeature') - width: visible ? 40 : 0 - height: 40 + width: visible ? 48 : 0 + height: 48 round: false iconSource: Theme.getThemeVectorIcon('ic_delete_forever_white_24dp')