Skip to content

Commit dc000a4

Browse files
committed
fix: fix AlertToolTip positioning and z-order issues
1. Changed AlertToolTip positioning from relative to absolute coordinates by calculating global position of target item 2. Added parent assignment to Overlay.overlay to ensure proper z- ordering above other UI elements 3. Added import for QtQuick.Controls to access Overlay component 4. Modified x and y calculations to use global coordinates instead of local coordinates 5. Added __itemGlobalPos property to compute cumulative position by traversing parent hierarchy Log: Fixed AlertToolTip display issues where tooltips were hidden behind other UI elements Influence: 1. Test AlertToolTip display with various target elements at different hierarchy levels 2. Verify tooltip appears above all other UI elements including dialogs and popups 3. Test tooltip positioning accuracy when target element is nested in multiple containers 4. Verify smooth animation behavior during tooltip show/hide transitions 5. Test tooltip display in complex layout scenarios with overlapping elements fix: 修复AlertToolTip定位和层级问题 1. 将AlertToolTip定位从相对坐标改为绝对坐标,通过计算目标项的全局位置 2. 添加父级设置为Overlay.overlay以确保正确的z轴排序,显示在其他UI元素 之上 3. 添加QtQuick.Controls导入以访问Overlay组件 4. 修改x和y计算使用全局坐标而非局部坐标 5. 添加__itemGlobalPos属性通过遍历父级层次结构计算累积位置 Log: 修复AlertToolTip显示问题,解决工具提示被其他UI元素遮挡的情况 Influence: 1. 测试AlertToolTip在不同层级目标元素上的显示 2. 验证工具提示是否显示在所有其他UI元素(包括对话框和弹出窗口)之上 3. 测试当目标元素嵌套在多个容器中时工具提示定位的准确性 4. 验证工具提示显示/隐藏过渡时的平滑动画行为 5. 测试在复杂布局场景中工具提示的显示效果 PMS: BUG-352961
1 parent 4da61c6 commit dc000a4

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

qt6/src/qml/AlertToolTip.qml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// SPDX-License-Identifier: LGPL-3.0-or-later
44

55
import QtQuick
6+
import QtQuick.Controls
67
import org.deepin.dtk 1.0 as D
78
import org.deepin.dtk.style 1.0 as DS
89

@@ -14,11 +15,22 @@ Control {
1415
property bool _expired: false
1516
readonly property bool _shown: control.visible && !_expired
1617

17-
x: 0
18-
y: (target ? target.height : 0) + (_shown ? DS.Style.control.spacing : 0)
18+
property point __itemGlobalPos: {
19+
let x = 0, y = 0
20+
let a = target
21+
while (a && a.parent) {
22+
x += a.x
23+
y += a.y
24+
a = a.parent
25+
}
26+
return Qt.point(x, y)
27+
}
28+
x: __itemGlobalPos.x
29+
y: __itemGlobalPos.y + (target ? target.height : 0) + (_shown ? DS.Style.control.spacing : 0)
1930
Behavior on y {
2031
NumberAnimation { duration: 200 }
2132
}
33+
parent: Overlay.overlay
2234
opacity: _shown ? 1 : 0
2335
enabled: _shown
2436
topPadding: DS.Style.alertToolTip.verticalPadding
@@ -27,7 +39,6 @@ Control {
2739
rightPadding: DS.Style.alertToolTip.horizontalPadding
2840
implicitWidth: target ? Math.min(DS.Style.control.implicitWidth(control), target.width) : DS.Style.control.implicitWidth(control)
2941
implicitHeight: DS.Style.control.implicitHeight(control)
30-
z: D.DTK.TopOrder
3142

3243
Timer {
3344
id: autoHideTimer

0 commit comments

Comments
 (0)