From bbaa5ccf3bf7768f66a721bbf52a231e0a339b42 Mon Sep 17 00:00:00 2001 From: miruka Date: Fri, 17 May 2019 15:39:00 -0400 Subject: [PATCH] Animate RoomCategoryDelegate visibility --- .../SidePane/RoomCategoryDelegate.qml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/harmonyqml/components/SidePane/RoomCategoryDelegate.qml b/harmonyqml/components/SidePane/RoomCategoryDelegate.qml index 92204068..573c7a80 100644 --- a/harmonyqml/components/SidePane/RoomCategoryDelegate.qml +++ b/harmonyqml/components/SidePane/RoomCategoryDelegate.qml @@ -8,8 +8,13 @@ Column { property int normalHeight: childrenRect.height // avoid binding loop - height: roomList.model.count > 0 ? normalHeight : 0 - visible: roomList.model.count > 0 + opacity: roomList.model.count > 0 ? 1 : 0 + height: normalHeight * opacity + visible: opacity > 0 + + Behavior on opacity { + NumberAnimation { duration: HStyle.animationDuration } + } property string roomListUserId: userId property bool expanded: true @@ -38,15 +43,16 @@ Column { interactive: false // no scrolling visible: height > 0 width: roomCategoriesList.width - accountList.Layout.leftMargin - height: childrenRect.height * (roomCategoryDelegate.expanded ? 1 : 0) - clip: heightAnimation.running + opacity: roomCategoryDelegate.expanded ? 1 : 0 + height: childrenRect.height * opacity + clip: listHeightAnimation.running userId: roomListUserId category: name - Behavior on height { + Behavior on opacity { NumberAnimation { - id: heightAnimation + id: listHeightAnimation duration: HStyle.animationDuration } }