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 Michał Cieślak
parent 0954a7d945
commit c58118a6e2
1 changed files with 4 additions and 3 deletions

View File

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