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"
|
border.color: objectItemButton.checked ? UM.Theme.getColor("primary") : "transparent"
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolTip
|
TextMetrics
|
||||||
{
|
{
|
||||||
visible: hovered
|
id: buttonTextMetrics
|
||||||
delay: 1000
|
text: buttonText.text
|
||||||
|
font: buttonText.font
|
||||||
|
elide: buttonText.elide
|
||||||
|
elideWidth: buttonText.width
|
||||||
|
}
|
||||||
|
|
||||||
contentItem: Text
|
Cura.ToolTip
|
||||||
{
|
{
|
||||||
text: objectItemButton.text
|
id: tooltip
|
||||||
font: UM.Theme.getFont("default")
|
tooltipText: objectItemButton.text
|
||||||
color: UM.Theme.getColor("tooltip_text")
|
visible: objectItemButton.hovered && buttonTextMetrics.elidedText != buttonText.text
|
||||||
}
|
|
||||||
background: Rectangle
|
|
||||||
{
|
|
||||||
color: UM.Theme.getColor("tooltip")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: Cura.SceneController.changeSelection(index)
|
onClicked: Cura.SceneController.changeSelection(index)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue