moment/harmonyqml/components/SidePane/RoomCategoryDelegate.qml

55 lines
1.3 KiB
QML
Raw Normal View History

import QtQuick 2.7
import QtQuick.Layouts 1.3
import "../Base"
Column {
id: roomCategoryDelegate
width: roomCategoriesList.width
property int normalHeight: childrenRect.height // avoid binding loop
height: roomList.model.count > 0 ? normalHeight : 0
visible: roomList.model.count > 0
property string roomListUserId: userId
property bool expanded: true
HRowLayout {
width: parent.width
HLabel {
id: roomCategoryLabel
text: name
font.weight: Font.DemiBold
elide: Text.ElideRight
maximumLineCount: 1
Layout.fillWidth: true
}
ExpandButton {
expandableItem: roomCategoryDelegate
iconDimension: 12
}
}
RoomList {
id: roomList
interactive: false // no scrolling
visible: height > 0
width: roomCategoriesList.width - accountList.Layout.leftMargin
height: childrenRect.height * (roomCategoryDelegate.expanded ? 1 : 0)
clip: heightAnimation.running
userId: roomListUserId
category: name
Behavior on height {
2019-05-15 05:15:10 +10:00
NumberAnimation {
id: heightAnimation
duration: HStyle.animationDuration
}
}
}
}