Animate RoomCategoryDelegate visibility

This commit is contained in:
miruka 2019-05-17 15:39:00 -04:00
parent 82edb4fc29
commit bbaa5ccf3b

View File

@ -8,8 +8,13 @@ Column {
property int normalHeight: childrenRect.height // avoid binding loop property int normalHeight: childrenRect.height // avoid binding loop
height: roomList.model.count > 0 ? normalHeight : 0 opacity: roomList.model.count > 0 ? 1 : 0
visible: roomList.model.count > 0 height: normalHeight * opacity
visible: opacity > 0
Behavior on opacity {
NumberAnimation { duration: HStyle.animationDuration }
}
property string roomListUserId: userId property string roomListUserId: userId
property bool expanded: true property bool expanded: true
@ -38,15 +43,16 @@ Column {
interactive: false // no scrolling interactive: false // no scrolling
visible: height > 0 visible: height > 0
width: roomCategoriesList.width - accountList.Layout.leftMargin width: roomCategoriesList.width - accountList.Layout.leftMargin
height: childrenRect.height * (roomCategoryDelegate.expanded ? 1 : 0) opacity: roomCategoryDelegate.expanded ? 1 : 0
clip: heightAnimation.running height: childrenRect.height * opacity
clip: listHeightAnimation.running
userId: roomListUserId userId: roomListUserId
category: name category: name
Behavior on height { Behavior on opacity {
NumberAnimation { NumberAnimation {
id: heightAnimation id: listHeightAnimation
duration: HStyle.animationDuration duration: HStyle.animationDuration
} }
} }