quickshell: animate calendar close on focus loss
Intercept grabFocus hide via onVisibleChanged — re-show popup briefly and animate height to 0 before truly hiding it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e271a79235
commit
25856f114f
1 changed files with 10 additions and 9 deletions
|
|
@ -518,10 +518,11 @@ in
|
|||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (calPopup.visible) {
|
||||
if (calPopup.visible && !calPopup.closing) {
|
||||
calPopup.closing = true;
|
||||
calPopup.open = false;
|
||||
calCloseTimer.start();
|
||||
} else {
|
||||
} else if (!calPopup.visible) {
|
||||
calPopup.visible = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -530,7 +531,7 @@ in
|
|||
Timer {
|
||||
id: calCloseTimer
|
||||
interval: 230
|
||||
onTriggered: calPopup.visible = false
|
||||
onTriggered: { calPopup.closing = false; calPopup.visible = false; }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -841,6 +842,7 @@ in
|
|||
color: "transparent"
|
||||
|
||||
property bool open: false
|
||||
property bool closing: false
|
||||
property real fullWidth: calCol.width + 32
|
||||
property real fullHeight: calCol.height + 24
|
||||
|
||||
|
|
@ -849,12 +851,11 @@ in
|
|||
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
open = true;
|
||||
}
|
||||
}
|
||||
|
||||
onActiveChanged: {
|
||||
if (!active && visible) {
|
||||
if (!closing) open = true;
|
||||
} else if (open && !closing) {
|
||||
// grabFocus hid us — re-show and animate closed
|
||||
closing = true;
|
||||
visible = true;
|
||||
open = false;
|
||||
calCloseTimer.start();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue