diff --git a/qt6/src/qml/AlertToolTip.qml b/qt6/src/qml/AlertToolTip.qml index 04d17aa9..1bd92be7 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 698a8def..2f6f0f2d 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 } }