Skip to content

Commit ed5c156

Browse files
committed
Improve position of tooltip
It is not ideal yet; of the tooltip is placed over the current mouseposition, the original mousearea looses its hover and the tooltip gets hidden immediately.
1 parent a3eedbd commit ed5c156

1 file changed

Lines changed: 18 additions & 11 deletions

File tree

resources/qml/SidebarStageMenu.qml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,6 @@ Item
187187
{
188188
target: tooltip
189189
enabled: !settingsDocked
190-
onTextChanged:
191-
{
192-
sidebarToolWindow.tooltipText = tooltip.text
193-
}
194190
onOpacityChanged:
195191
{
196192
if(tooltip.opacity == 0)
@@ -202,6 +198,21 @@ Item
202198
sidebarToolWindow.showTooltip()
203199
}
204200
}
201+
onTextChanged:
202+
{
203+
/* The div automatically adapts to 100% of the parent width and
204+
wraps properly, so this causes the tooltips to be wrapped to the width
205+
of the tooltip as set by the operating system. */
206+
207+
sidebarToolWindow.tooltipText = "<div>" + tooltip.text + "</div>"
208+
}
209+
onYChanged:
210+
{
211+
sidebarToolWindow.tooltipPosition = Qt.point(
212+
UM.Theme.getSize("default_margin").width,
213+
tooltip.y + 3 * UM.Theme.getSize("default_margin").height
214+
)
215+
}
205216
}
206217

207218
onPreSlicedDataChanged:
@@ -308,12 +319,10 @@ Item
308319
height: minimumHeight
309320

310321
property string tooltipText
322+
property var tooltipPosition
311323
function showTooltip()
312324
{
313-
/* The divider automatically adapts to 100% of the parent width and
314-
wraps properly, so this causes the tooltips to be wrapped to the width
315-
of the tooltip as set by the operating system. */
316-
Tooltip.showText(printSetupWindow, Qt.point(printSetupWindow.mouseX, printSetupWindow.mouseY), "<div>" + tooltipText + "</div>")
325+
Tooltip.showText(printSetupWindow, tooltipPosition, tooltipText)
317326
}
318327

319328
function hideTooltip()
@@ -336,13 +345,11 @@ Item
336345
}
337346
}
338347

339-
MouseArea
348+
Item
340349
{
341350
id: printSetupWindow
342351

343352
anchors.fill: parent
344-
hoverEnabled: true
345-
acceptedButtons: Qt.NoButton
346353
}
347354
}
348355
}

0 commit comments

Comments
 (0)