diff options
author | Jaime van Kessel <nallath@gmail.com> | 2020-08-11 15:26:03 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2020-08-11 15:26:03 +0300 |
commit | 5840205442b000bdbcc61a784b286e80e422bf5c (patch) | |
tree | ed1a46aad1faabbb718f8c212fe37c2a586a4f53 /resources | |
parent | c49056f319b7606be5f1ff1a7bbdc800a9d88604 (diff) | |
parent | 10857094070e79aabce25bd4fbcb394a0f5d3d68 (diff) |
Merge branch 'setting_tooltip_interaction' of github.com:Ultimaker/Cura
Diffstat (limited to 'resources')
-rw-r--r-- | resources/qml/PrintSetupTooltip.qml | 55 |
1 files changed, 39 insertions, 16 deletions
diff --git a/resources/qml/PrintSetupTooltip.qml b/resources/qml/PrintSetupTooltip.qml index 41d68aef37..6b39842ec0 100644 --- a/resources/qml/PrintSetupTooltip.qml +++ b/resources/qml/PrintSetupTooltip.qml @@ -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 @@ -11,7 +11,7 @@ UM.PointingRectangle id: base property real sourceWidth: 0 width: UM.Theme.getSize("tooltip").width - height: label.height + UM.Theme.getSize("tooltip_margins").height * 2 + height: textScroll.height + UM.Theme.getSize("tooltip_margins").height * 2 color: UM.Theme.getColor("tooltip") arrowSize: UM.Theme.getSize("default_arrow").width @@ -59,22 +59,45 @@ 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(target.x - 1, target.y - UM.Theme.getSize("tooltip_arrow_margins").height / 2)); //Same arrow position as before. + } + else + { + base.hide(); + } + } + + ScrollView + { + id: textScroll + width: parent.width + height: Math.min(label.height, base.parent.height) + + ScrollBar.horizontal: ScrollBar { + active: false //Only allow vertical scrolling. We should grow vertically only, but due to how the label is positioned it allocates space in the ScrollView horizontally. + } + + 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 + 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 } } |