mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-04 11:14:21 +08:00
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:
parent
3f599bd06f
commit
0965d909c0
@ -115,6 +115,6 @@ Button
|
|||||||
Cura.ToolTip
|
Cura.ToolTip
|
||||||
{
|
{
|
||||||
id: tooltip
|
id: tooltip
|
||||||
show: button.hovered
|
visible: button.hovered
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,29 +9,26 @@ import Cura 1.0 as Cura
|
|||||||
|
|
||||||
ToolTip
|
ToolTip
|
||||||
{
|
{
|
||||||
|
|
||||||
enum ContentAlignment
|
enum ContentAlignment
|
||||||
{
|
{
|
||||||
AlignLeft,
|
AlignLeft,
|
||||||
AlignRight
|
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
|
// Defines the alignment of the content, by default to the left
|
||||||
property int contentAlignment: Cura.ToolTip.ContentAlignment.AlignRight
|
property int contentAlignment: Cura.ToolTip.ContentAlignment.AlignRight
|
||||||
|
|
||||||
property alias tooltipText: tooltip.text
|
property alias tooltipText: tooltip.text
|
||||||
property var targetPoint: Qt.point(parent.x, y + Math.round(height/2))
|
property var targetPoint: Qt.point(parent.x, y + Math.round(height/2))
|
||||||
|
|
||||||
|
|
||||||
id: tooltip
|
id: tooltip
|
||||||
text: ""
|
text: ""
|
||||||
delay: 500
|
delay: 500
|
||||||
visible: text != "" && show
|
|
||||||
font: UM.Theme.getFont("default")
|
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:
|
x:
|
||||||
{
|
{
|
||||||
if (contentAlignment == Cura.ToolTip.ContentAlignment.AlignLeft)
|
if (contentAlignment == Cura.ToolTip.ContentAlignment.AlignLeft)
|
||||||
@ -43,7 +40,7 @@ ToolTip
|
|||||||
|
|
||||||
y: Math.round(parent.height / 2 - label.height / 2 ) - padding
|
y: Math.round(parent.height / 2 - label.height / 2 ) - padding
|
||||||
|
|
||||||
padding: 2
|
padding: UM.Theme.getSize("thin_margin").width
|
||||||
|
|
||||||
background: UM.PointingRectangle
|
background: UM.PointingRectangle
|
||||||
{
|
{
|
||||||
|
@ -101,6 +101,6 @@ Button
|
|||||||
{
|
{
|
||||||
id: tooltip
|
id: tooltip
|
||||||
tooltipText: base.text
|
tooltipText: base.text
|
||||||
show: base.hovered
|
visible: base.hovered
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user