mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 07:33:57 -06:00
Fix the tooltip not re-sizing
I'm not entirely sure if this fixes it on windows, but it does at least fix things on Linux. There are a few important changes to note here: 1. Increased the time of the fade timer to 200ms 2. Removed the mousearea, instead using the hover of scrollview So why are these important? Nr 1 seems to be because updates seem to be faster? If I set it to 100 I could get it to work reasonably well on qt5, but in qt6, it's about 50% of the times that i'm too slow. So we need the extra time. As for the mouse area, it seems that the scrollview was eating up all the hover / containsMouse events. As scrollview has the same properties that we need, we can just get rid of the mouseArea CURA-9112
This commit is contained in:
parent
698adc45db
commit
0213a3833c
1 changed files with 20 additions and 27 deletions
|
@ -11,7 +11,7 @@ UM.PointingRectangle
|
||||||
id: base
|
id: base
|
||||||
property real sourceWidth: 0
|
property real sourceWidth: 0
|
||||||
width: UM.Theme.getSize("tooltip").width
|
width: UM.Theme.getSize("tooltip").width
|
||||||
height: UM.Theme.getSize("tooltip").height
|
height: textScroll.height + UM.Theme.getSize("tooltip_margins").height * 2
|
||||||
color: UM.Theme.getColor("tooltip")
|
color: UM.Theme.getColor("tooltip")
|
||||||
|
|
||||||
arrowSize: UM.Theme.getSize("default_arrow").width
|
arrowSize: UM.Theme.getSize("default_arrow").width
|
||||||
|
@ -20,7 +20,7 @@ UM.PointingRectangle
|
||||||
|
|
||||||
Behavior on opacity
|
Behavior on opacity
|
||||||
{
|
{
|
||||||
NumberAnimation { duration: 100; }
|
NumberAnimation { duration: 200; }
|
||||||
}
|
}
|
||||||
|
|
||||||
property alias text: label.text
|
property alias text: label.text
|
||||||
|
@ -59,16 +59,19 @@ UM.PointingRectangle
|
||||||
base.opacity = 0;
|
base.opacity = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea
|
ScrollView
|
||||||
{
|
{
|
||||||
enabled: parent.opacity > 0
|
id: textScroll
|
||||||
visible: enabled
|
width: parent.width
|
||||||
anchors.fill: parent
|
height: Math.min(label.height, base.parent.height)
|
||||||
acceptedButtons: Qt.NoButton
|
|
||||||
hoverEnabled: true
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||||
|
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||||
|
|
||||||
|
hoverEnabled: parent.opacity > 0
|
||||||
onHoveredChanged:
|
onHoveredChanged:
|
||||||
{
|
{
|
||||||
if(containsMouse && base.opacity > 0)
|
if(hovered && base.opacity > 0)
|
||||||
{
|
{
|
||||||
base.show(Qt.point(target.x - 1, target.y - UM.Theme.getSize("tooltip_arrow_margins").height / 2)); //Same arrow position as before.
|
base.show(Qt.point(target.x - 1, target.y - UM.Theme.getSize("tooltip_arrow_margins").height / 2)); //Same arrow position as before.
|
||||||
}
|
}
|
||||||
|
@ -78,26 +81,16 @@ UM.PointingRectangle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollView
|
UM.Label
|
||||||
{
|
{
|
||||||
id: textScroll
|
id: label
|
||||||
width: base.width
|
x: UM.Theme.getSize("tooltip_margins").width
|
||||||
height: base.height
|
y: UM.Theme.getSize("tooltip_margins").height
|
||||||
|
width: textScroll.width - 2 * UM.Theme.getSize("tooltip_margins").width
|
||||||
|
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
wrapMode: Text.Wrap
|
||||||
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
textFormat: Text.RichText
|
||||||
|
color: UM.Theme.getColor("tooltip_text")
|
||||||
UM.Label
|
|
||||||
{
|
|
||||||
id: label
|
|
||||||
x: UM.Theme.getSize("tooltip_margins").width
|
|
||||||
y: UM.Theme.getSize("tooltip_margins").height
|
|
||||||
width: base.width - UM.Theme.getSize("tooltip_margins").width * 2
|
|
||||||
|
|
||||||
wrapMode: Text.Wrap
|
|
||||||
textFormat: Text.RichText
|
|
||||||
color: UM.Theme.getColor("tooltip_text")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue