From 88625dc83de7d5a8491f735591a30876e2dd744f Mon Sep 17 00:00:00 2001 From: ck Date: Tue, 20 Aug 2024 17:01:40 +0800 Subject: [PATCH] chore: animation tweak - switch animation duration 500ms - listview hovered background color remove shadowcolor - listview hovered background size adapt to hovered item's background --- qt6/src/qml/ListView.qml | 10 ++++++---- qt6/src/qml/Switch.qml | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/qt6/src/qml/ListView.qml b/qt6/src/qml/ListView.qml index ba2da84d..3abfd6fe 100644 --- a/qt6/src/qml/ListView.qml +++ b/qt6/src/qml/ListView.qml @@ -23,8 +23,8 @@ ListView { bgVisible = (background.x <= 0 && background.y <= 0) ? false : hoveredItem.hovered background.x = hoveredItem.x - contentX background.y = hoveredItem.y - contentY - background.width = hoveredItem.implicitWidth - background.height = hoveredItem.implicitHeight + background.width = hoveredItem.background.width + background.height = hoveredItem.background.height bgVisible = hoveredItem.hovered control.state = bgVisible ? "Visible" : "Invisible" } else { @@ -151,8 +151,8 @@ ListView { Item { id: background - implicitWidth: DS.Style.itemDelegate.width - implicitHeight: DS.Style.itemDelegate.height + implicitWidth: hoveredItem ? hoveredItem.background.width : DS.Style.itemDelegate.width + implicitHeight: hoveredItem ? hoveredItem.background.height : DS.Style.itemDelegate.height z: -1 Loader { @@ -163,6 +163,8 @@ ListView { enableAnimation: false // avoid hover animation outsideBorderColor: null insideBorderColor: null + innerShadowColor1: null + innerShadowColor2: null visible: hoveredItem && !hoveredItem.checked && hoveredItem.enabled color1: D.Palette { normal { diff --git a/qt6/src/qml/Switch.qml b/qt6/src/qml/Switch.qml index 4844b967..67458d25 100644 --- a/qt6/src/qml/Switch.qml +++ b/qt6/src/qml/Switch.qml @@ -43,7 +43,7 @@ T.Switch { Timer { id: toggletimer - interval: 300 + interval: 500 onTriggered: { control.toggle() }