Keep tooltip visible when hovering over it

Except when hovering over it while it's completely invisible. You just get this 100ms leeway time to transition from the setting to the tooltip.
This commit is contained in:
Ghostkeeper 2020-08-05 02:16:16 +02:00
parent 96e631bfda
commit d710d42c0a
No known key found for this signature in database
GPG Key ID: D2A8871EE34EC59A

View File

@ -1,4 +1,4 @@
// Copyright (c) 2019 Ultimaker B.V.
// Copyright (c) 2020 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
@ -59,22 +59,39 @@ UM.PointingRectangle
base.opacity = 0;
}
Label
MouseArea
{
id: label;
anchors
anchors.fill: parent
hoverEnabled: true
onHoveredChanged:
{
top: parent.top;
topMargin: UM.Theme.getSize("tooltip_margins").height;
left: parent.left;
leftMargin: UM.Theme.getSize("tooltip_margins").width;
right: parent.right;
rightMargin: UM.Theme.getSize("tooltip_margins").width;
if(containsMouse && base.opacity > 0)
{
base.show(Qt.point(base.x + base.width, base.y + UM.Theme.getSize("tooltip_arrow_margins").height));
}
else
{
base.hide();
}
}
Label
{
id: label
anchors
{
top: parent.top;
topMargin: UM.Theme.getSize("tooltip_margins").height;
left: parent.left;
leftMargin: UM.Theme.getSize("tooltip_margins").width;
right: parent.right;
rightMargin: UM.Theme.getSize("tooltip_margins").width;
}
wrapMode: Text.Wrap;
textFormat: Text.RichText
font: UM.Theme.getFont("default");
color: UM.Theme.getColor("tooltip_text");
renderType: Text.NativeRendering
}
wrapMode: Text.Wrap;
textFormat: Text.RichText
font: UM.Theme.getFont("default");
color: UM.Theme.getColor("tooltip_text");
renderType: Text.NativeRendering
}
}