Possible fix for unknown screen (bar not displaying)
This commit is contained in:
parent
7b26ddaa32
commit
1993e28c18
4 changed files with 51 additions and 1 deletions
|
|
@ -10,6 +10,8 @@ Window {
|
|||
property Item target: null
|
||||
property int delay: Style.tooltipDelay
|
||||
property bool positionAbove: false
|
||||
property bool positionLeft: false
|
||||
property bool positionRight: false
|
||||
|
||||
flags: Qt.ToolTip | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint
|
||||
color: Color.transparent
|
||||
|
|
@ -44,7 +46,17 @@ Window {
|
|||
return
|
||||
}
|
||||
|
||||
if (positionAbove) {
|
||||
if (positionLeft) {
|
||||
// Position tooltip to the left of the target
|
||||
var pos = target.mapToGlobal(0, 0)
|
||||
x = pos.x - width - 12 // 12 px margin to the left
|
||||
y = pos.y - height / 2 + target.height / 2
|
||||
} else if (positionRight) {
|
||||
// Position tooltip to the right of the target
|
||||
var pos = target.mapToGlobal(target.width, 0)
|
||||
x = pos.x + 12 // 12 px margin to the right
|
||||
y = pos.y - height / 2 + target.height / 2
|
||||
} else if (positionAbove) {
|
||||
// Position tooltip above the target
|
||||
var pos = target.mapToGlobal(0, 0)
|
||||
x = pos.x - width / 2 + target.width / 2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue