Remove the show property from the tooltip

This was a bit of a weird setup, so i removed it. This way the tooltip can be used
in the same way as the regular tooltip (by simply setting the visibility)

CURA-6004
This commit is contained in:
Jaime van Kessel 2018-12-20 16:41:26 +01:00
parent 3f599bd06f
commit 0965d909c0
3 changed files with 6 additions and 9 deletions

View File

@ -115,6 +115,6 @@ Button
Cura.ToolTip
{
id: tooltip
show: button.hovered
visible: button.hovered
}
}

View File

@ -9,28 +9,25 @@ import Cura 1.0 as Cura
ToolTip
{
enum ContentAlignment
{
AlignLeft,
AlignRight
}
// This property indicates when the tooltip has to show, for instance when a button is hovered
property bool show: false
// Defines the alignment of the content, by default to the left
property int contentAlignment: Cura.ToolTip.ContentAlignment.AlignRight
property alias tooltipText: tooltip.text
property var targetPoint: Qt.point(parent.x, y + Math.round(height/2))
id: tooltip
text: ""
delay: 500
visible: text != "" && show
font: UM.Theme.getFont("default")
// If the text is not set, just set the height to 0 to prevent it from showing
height: text != "" ? label.contentHeight + 2 * UM.Theme.getSize("thin_margin").width: 0
x:
{
@ -43,7 +40,7 @@ ToolTip
y: Math.round(parent.height / 2 - label.height / 2 ) - padding
padding: 2
padding: UM.Theme.getSize("thin_margin").width
background: UM.PointingRectangle
{

View File

@ -101,6 +101,6 @@ Button
{
id: tooltip
tooltipText: base.text
show: base.hovered
visible: base.hovered
}
}