diff --git a/harmonyqml/components/sidePane/RoomCategoryDelegate.qml b/harmonyqml/components/sidePane/RoomCategoryDelegate.qml index 2f741119..9545c0f1 100644 --- a/harmonyqml/components/sidePane/RoomCategoryDelegate.qml +++ b/harmonyqml/components/sidePane/RoomCategoryDelegate.qml @@ -3,7 +3,6 @@ import "../base" as Base Base.HLabel { width: roomList.width - height: text.height // topPadding is provided by the roomList spacing bottomPadding: roomList.spacing diff --git a/harmonyqml/components/sidePane/RoomList.qml b/harmonyqml/components/sidePane/RoomList.qml index 559830bb..9bbfe819 100644 --- a/harmonyqml/components/sidePane/RoomList.qml +++ b/harmonyqml/components/sidePane/RoomList.qml @@ -7,11 +7,21 @@ ListView { property var forUserId: null property int childrenHeight: 36 + property int sectionHeight: 16 + spacing property int contentHeight: 0 onCountChanged: { - contentHeight = childrenHeight * model.count + - spacing * (model.count - 1) + var sections = [] + + for (var i = 0; i < model.count; i++) { + var categ = model.get(i).category + if (sections.indexOf(categ) == -1) { sections.push(categ) } + } + + contentHeight = + childrenHeight * model.count + + spacing * Math.max(0, (model.count - 1)) + + sectionHeight * sections.length } id: roomList @@ -20,5 +30,5 @@ ListView { delegate: RoomDelegate {} section.property: "category" - section.delegate: RoomCategoryDelegate {} + section.delegate: RoomCategoryDelegate { height: sectionHeight } }