From f96893a33e6cc6b694f3a483ee0734d288a72637 Mon Sep 17 00:00:00 2001 From: "deepin-bot[bot]" <100105596+deepin-bot[bot]@users.noreply.github.com> Date: Tue, 22 Sep 2026 17:15:31 +0800 Subject: [PATCH] fix: stabilize AlertToolTip overlay parenting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Add shown property and derive visible state from it 2. Resolve the overlay through target.Overlay.overlay to avoid parent-dependent lookup 3. Bind parent to the overlay while shown and restore target when hidden 4. Update EditPanel to control shown instead of visible Influence: 1. Verify alert tooltip appears above edit controls 2. Confirm show/hide cycles emit no binding loop warnings 3. Verify timeout expiration hides the tooltip correctly 4. Confirm tooltip returns to target when hidden fix: 稳定 AlertToolTip 的 Overlay 父级切换 1. 新增 shown 属性,并由其派生 visible 状态 2. 通过 target.Overlay.overlay 获取 Overlay,避免依赖当前父级查询 3. 显示时将父级绑定到 Overlay,隐藏时恢复为 target 4. 更新 EditPanel,使用 shown 代替 visible 控制提示框 Influence: 1. 验证告警提示框在编辑控件上方正确显示 2. 确认显示/隐藏循环不再产生 binding loop 警告 3. 验证超时后提示框能够正确隐藏 4. 确认隐藏时 tooltip 父级正确回到 target PMS: TASK-392413 --- qt6/src/qml/AlertToolTip.qml | 9 +++++++-- qt6/src/qml/EditPanel.qml | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/qt6/src/qml/AlertToolTip.qml b/qt6/src/qml/AlertToolTip.qml index 04d17aa9a..1bd92be78 100644 --- a/qt6/src/qml/AlertToolTip.qml +++ b/qt6/src/qml/AlertToolTip.qml @@ -12,8 +12,10 @@ Control { property Item target property string text property int timeout: 0 + property bool requestVisible: false property bool _expired: false - readonly property bool _shown: control.visible && !_expired + readonly property bool _shown: requestVisible && !_expired + visible: requestVisible property point __itemGlobalPos: { let x = 0, y = 0 @@ -30,7 +32,10 @@ Control { Behavior on y { NumberAnimation { duration: 200 } } - parent: _shown ? Overlay.overlay : target + parent: { + const overlay = target ? target.Overlay.overlay : null + return _shown && overlay ? overlay : target + } opacity: _shown ? 1 : 0 enabled: _shown topPadding: DS.Style.alertToolTip.verticalPadding diff --git a/qt6/src/qml/EditPanel.qml b/qt6/src/qml/EditPanel.qml index 698a8def0..2f6f0f2d0 100644 --- a/qt6/src/qml/EditPanel.qml +++ b/qt6/src/qml/EditPanel.qml @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2021 - 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2021 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: LGPL-3.0-or-later @@ -39,7 +39,7 @@ Rectangle { sourceComponent: AlertToolTip { target: control timeout: alertDuration - visible: showAlert + requestVisible: showAlert text: alertText } }