mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 22:54:01 -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
|
||||
property real sourceWidth: 0
|
||||
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")
|
||||
|
||||
arrowSize: UM.Theme.getSize("default_arrow").width
|
||||
|
@ -20,7 +20,7 @@ UM.PointingRectangle
|
|||
|
||||
Behavior on opacity
|
||||
{
|
||||
NumberAnimation { duration: 100; }
|
||||
NumberAnimation { duration: 200; }
|
||||
}
|
||||
|
||||
property alias text: label.text
|
||||
|
@ -59,16 +59,19 @@ UM.PointingRectangle
|
|||
base.opacity = 0;
|
||||
}
|
||||
|
||||
MouseArea
|
||||
ScrollView
|
||||
{
|
||||
enabled: parent.opacity > 0
|
||||
visible: enabled
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.NoButton
|
||||
hoverEnabled: true
|
||||
id: textScroll
|
||||
width: parent.width
|
||||
height: Math.min(label.height, base.parent.height)
|
||||
|
||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||
|
||||
hoverEnabled: parent.opacity > 0
|
||||
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.
|
||||
}
|
||||
|
@ -78,26 +81,16 @@ UM.PointingRectangle
|
|||
}
|
||||
}
|
||||
|
||||
ScrollView
|
||||
UM.Label
|
||||
{
|
||||
id: textScroll
|
||||
width: base.width
|
||||
height: base.height
|
||||
id: label
|
||||
x: UM.Theme.getSize("tooltip_margins").width
|
||||
y: UM.Theme.getSize("tooltip_margins").height
|
||||
width: textScroll.width - 2 * UM.Theme.getSize("tooltip_margins").width
|
||||
|
||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||
|
||||
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")
|
||||
}
|
||||
wrapMode: Text.Wrap
|
||||
textFormat: Text.RichText
|
||||
color: UM.Theme.getColor("tooltip_text")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue