Always display tooltip on combobox items if text gets elided

So if the text is too long to display, there is still a way to display it.
This commit is contained in:
Ghostkeeper 2020-11-17 10:52:25 +01:00
parent 5e383d4f42
commit 29258aa5e2
No known key found for this signature in database
GPG Key ID: D2A8871EE34EC59A

View File

@ -124,6 +124,7 @@ ComboBox
contentItem: Label contentItem: Label
{ {
id: delegateLabel
// FIXME: Somehow the top/bottom anchoring is not correct on Linux and it results in invisible texts. // FIXME: Somehow the top/bottom anchoring is not correct on Linux and it results in invisible texts.
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width
@ -138,10 +139,15 @@ ComboBox
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
background: Rectangle background: UM.TooltipArea
{ {
color: parent.highlighted ? UM.Theme.getColor("setting_control_highlight") : "transparent" Rectangle
border.color: parent.highlighted ? UM.Theme.getColor("setting_control_border_highlight") : "transparent" {
color: parent.highlighted ? UM.Theme.getColor("setting_control_highlight") : "transparent"
border.color: parent.highlighted ? UM.Theme.getColor("setting_control_border_highlight") : "transparent"
anchors.fill: parent
}
text: delegateLabel.truncated ? delegateItem.text : ""
} }
} }
} }