feat(StatusToolTip): Adding an offset property

Added an offset property with which the arrow position for the tooltip can be adjusted from the outside
This commit is contained in:
Khushboo Mehta 2021-08-12 16:29:36 +02:00 committed by Pascal Precht
parent 87ae7b90e7
commit ee4296837a
1 changed files with 4 additions and 3 deletions

View File

@ -15,6 +15,7 @@ ToolTip {
property int maxWidth: 800
property int orientation: StatusToolTip.Orientation.Top
property int offset: 0
property alias arrow: arrow
implicitWidth: Math.min(maxWidth, textContent.implicitWidth + 16)
@ -41,13 +42,13 @@ ToolTip {
radius: 1
x: {
if (orientation === StatusToolTip.Orientation.Top || orientation === StatusToolTip.Orientation.Bottom) {
return statusToolTipBackground.width / 2 - width / 2
return statusToolTipBackground.width / 2 - width / 2 + offset
}
if (orientation === StatusToolTip.Orientation.Left) {
return statusToolTipContentBackground.width - (width / 2) - 8
return statusToolTipContentBackground.width - (width / 2) - 8 + offset
}
if (orientation === StatusToolTip.Orientation.Right) {
return -width/2 + 8
return -width/2 + 8 + offset
}
}
y: {