Skip to content

Commit

Permalink
Fix lack of multiline handling in the relation editor widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Feb 1, 2025
1 parent 72a9ea3 commit f85a008
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 19 deletions.
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

1 comment on commit f85a008

@qfield-fairy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.