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 text wrapping for the relation combobox popup's items list #5977

Merged
merged 1 commit into from
Feb 4, 2025
Merged
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
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
Loading