Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions qt6/src/qml/AlertToolTip.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// SPDX-License-Identifier: LGPL-3.0-or-later

import QtQuick
import QtQuick.Controls
import org.deepin.dtk 1.0 as D
import org.deepin.dtk.style 1.0 as DS

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

x: 0
y: (target ? target.height : 0) + (_shown ? DS.Style.control.spacing : 0)
property point __itemGlobalPos: {
let x = 0, y = 0
let a = target
while (a && a.parent) {
x += a.x
y += a.y
a = a.parent
}
return Qt.point(x, y)
}
x: __itemGlobalPos.x
y: __itemGlobalPos.y + (target ? target.height : 0) + (_shown ? DS.Style.control.spacing : 0)
Behavior on y {
NumberAnimation { duration: 200 }
}
parent: Overlay.overlay
opacity: _shown ? 1 : 0
enabled: _shown
topPadding: DS.Style.alertToolTip.verticalPadding
Expand All @@ -27,7 +39,6 @@ Control {
rightPadding: DS.Style.alertToolTip.horizontalPadding
implicitWidth: target ? Math.min(DS.Style.control.implicitWidth(control), target.width) : DS.Style.control.implicitWidth(control)
implicitHeight: DS.Style.control.implicitHeight(control)
z: D.DTK.TopOrder

Timer {
id: autoHideTimer
Expand Down
Loading