mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Reuse the Cura ToolTip while showing long object item
It will only show the tooltip when the text is longer than the elided text. Contributes to CURA-6666.
This commit is contained in:
parent
fd452e74b3
commit
b9ed619c9a
1 changed files with 12 additions and 13 deletions
|
@ -51,21 +51,20 @@ Button
|
|||
border.color: objectItemButton.checked ? UM.Theme.getColor("primary") : "transparent"
|
||||
}
|
||||
|
||||
ToolTip
|
||||
TextMetrics
|
||||
{
|
||||
visible: hovered
|
||||
delay: 1000
|
||||
id: buttonTextMetrics
|
||||
text: buttonText.text
|
||||
font: buttonText.font
|
||||
elide: buttonText.elide
|
||||
elideWidth: buttonText.width
|
||||
}
|
||||
|
||||
contentItem: Text
|
||||
{
|
||||
text: objectItemButton.text
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("tooltip_text")
|
||||
}
|
||||
background: Rectangle
|
||||
{
|
||||
color: UM.Theme.getColor("tooltip")
|
||||
}
|
||||
Cura.ToolTip
|
||||
{
|
||||
id: tooltip
|
||||
tooltipText: objectItemButton.text
|
||||
visible: objectItemButton.hovered && buttonTextMetrics.elidedText != buttonText.text
|
||||
}
|
||||
|
||||
onClicked: Cura.SceneController.changeSelection(index)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue