Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix value relation filter breaking after changing attribute value(s), improve relation editor widget handling of multiline feature display names #5968

Merged
merged 2 commits into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/core/featurelistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,9 @@ void FeatureListModel::setCurrentFormFeature( const QgsFeature &feature )
mCurrentFormFeature = feature;

if ( !mFilterExpression.isEmpty() && QgsValueRelationFieldFormatter::expressionRequiresFormScope( mFilterExpression ) )
{
reloadLayer();
}

emit currentFormFeatureChanged();
}
4 changes: 0 additions & 4 deletions src/qml/editorwidgets/ValueRelation.qml
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,4 @@ EditorWidgetBase {
}
}
}

function siblingValueChanged(field, feature) {
listModel.currentFormFeature = feature;
}
}
35 changes: 21 additions & 14 deletions src/qml/editorwidgets/relationeditors/ordered_relation_editor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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')
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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')
Expand Down
15 changes: 10 additions & 5 deletions src/qml/editorwidgets/relationeditors/relation_editor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import ".."
EditorWidgetBase {
id: relationEditor

property int itemHeight: 40
property int itemHeight: 48
property int bottomMargin: 10
property int maximumVisibleItems: 4

Expand Down Expand Up @@ -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')
Expand All @@ -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')
Expand Down
Loading