lock: animate left pill appearance too

This commit is contained in:
end-4 2025-09-05 08:08:43 +02:00
parent f199bc4256
commit 4dcc1f340f

View file

@ -1,12 +1,10 @@
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import Qt5Compat.GraphicalEffects
import qs import qs
import qs.services import qs.services
import qs.modules.common import qs.modules.common
import qs.modules.common.widgets import qs.modules.common.widgets
import qs.modules.common.functions import qs.modules.common.functions
import qs.modules.bar as Bar
MouseArea { MouseArea {
id: root id: root
@ -18,10 +16,6 @@ MouseArea {
passwordBox.forceActiveFocus(); passwordBox.forceActiveFocus();
} }
Component.onCompleted: {
forceFieldFocus();
}
Connections { Connections {
target: context target: context
function onShouldReFocus() { function onShouldReFocus() {
@ -29,6 +23,25 @@ MouseArea {
} }
} }
property real toolbarScale: 0.9
property real toolbarOpacity: 0
Behavior on toolbarScale {
NumberAnimation {
duration: Appearance.animation.elementMove.duration
easing.type: Appearance.animation.elementMove.type
easing.bezierCurve: Appearance.animationCurves.expressiveFastSpatial
}
}
Behavior on toolbarOpacity {
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
}
Component.onCompleted: {
forceFieldFocus();
toolbarScale = 1;
toolbarOpacity = 1;
}
Keys.onPressed: event => { // Esc to clear Keys.onPressed: event => { // Esc to clear
if (event.key === Qt.Key_Escape) { if (event.key === Qt.Key_Escape) {
root.context.currentText = ""; root.context.currentText = "";
@ -74,22 +87,8 @@ MouseArea {
animation: Appearance.animation.elementMove.numberAnimation.createObject(this) animation: Appearance.animation.elementMove.numberAnimation.createObject(this)
} }
scale: 0.9 scale: root.toolbarScale
opacity: 0 opacity: root.toolbarOpacity
Component.onCompleted: {
scale = 1;
opacity = 1;
}
Behavior on scale {
NumberAnimation {
duration: Appearance.animation.elementMove.duration
easing.type: Appearance.animation.elementMove.type
easing.bezierCurve: Appearance.animationCurves.expressiveFastSpatial
}
}
Behavior on opacity {
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
}
ToolbarTextField { ToolbarTextField {
id: passwordBox id: passwordBox
@ -143,6 +142,9 @@ MouseArea {
rightMargin: 20 rightMargin: 20
} }
scale: root.toolbarScale
opacity: root.toolbarOpacity
ToolbarButton { ToolbarButton {
id: powerButton id: powerButton
implicitWidth: height implicitWidth: height