Skip to content

Commit

Permalink
Fix text wrapping for the relation combobox popup's items list
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Feb 4, 2025
1 parent aa35ec6 commit d7daefb
Showing 1 changed file with 21 additions and 27 deletions.
48 changes: 21 additions & 27 deletions src/qml/RelationCombobox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -147,23 +147,28 @@ Item {
}

delegate: Rectangle {
id: delegateRect
id: rectangle

property int idx: index
property string itemText: StringUtils.highlightText(displayString, featureListModel.searchTerm, Theme.mainTextColor)

anchors.margins: 10
height: radioButton.visible ? radioButton.height : checkBoxButton.height
width: parent ? parent.width : undefined
height: line.height + 20
color: model.checked ? Theme.mainColor : searchFeaturePopup.Material ? searchFeaturePopup.Material.dialogColor : Theme.mainBackgroundColor

Row {
id: line
anchors.verticalCenter: parent.verticalCenter
spacing: 5

RadioButton {
id: radioButton

visible: !featureListModel.allowMulti
anchors.verticalCenter: parent.verticalCenter
width: resultsList.width - padding * 2
width: 0
height: 48
padding: 12

font.pointSize: Theme.defaultFont.pointSize
Expand All @@ -172,42 +177,31 @@ Item {
checked: model.checked
indicator: Rectangle {
}

text: itemText
contentItem: Text {
text: parent.text
font: parent.font
width: parent.width
verticalAlignment: Text.AlignVCenter
leftPadding: parent.indicator.width + parent.spacing
elide: Text.ElideRight
color: featureListModel.searchTerm != '' ? Theme.secondaryTextColor : Theme.mainTextColor
textFormat: Text.RichText
}
}

CheckBox {
id: checkBoxButton

visible: !!featureListModel.allowMulti
anchors.verticalCenter: parent.verticalCenter
width: resultsList.width - padding * 2
padding: 12

font.pointSize: Theme.defaultFont.pointSize
font.weight: model.checked ? Font.DemiBold : Font.Normal
}

Text {
id: contentText
width: rectangle.width - (checkBoxButton.visible ? checkBoxButton.width : radioButton.width) - 10
anchors.verticalCenter: parent.verticalCenter
leftPadding: 5
font.pointSize: Theme.defaultFont.pointSize
font.weight: model.checked ? Font.DemiBold : Font.Normal
elide: Text.ElideRight
wrapMode: Text.WordWrap
color: featureListModel.searchTerm != '' ? Theme.secondaryTextColor : Theme.mainTextColor
textFormat: Text.RichText
text: itemText
contentItem: Text {
text: parent.text
font: parent.font
width: parent.width
verticalAlignment: Text.AlignVCenter
leftPadding: parent.indicator.width + parent.spacing
elide: Text.ElideRight
color: Theme.mainTextColor
textFormat: Text.RichText
}
}
}

Expand All @@ -216,7 +210,7 @@ Item {
anchors.bottom: parent.bottom
height: 1
color: Theme.controlBorderColor
width: resultsList.width
width: parent.width
}

function performClick() {
Expand Down

1 comment on commit d7daefb

@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.