diff --git a/src/rooms/RoomListPage.qml b/src/rooms/RoomListPage.qml index bb4cccc18..4ff944931 100644 --- a/src/rooms/RoomListPage.qml +++ b/src/rooms/RoomListPage.qml @@ -139,6 +139,7 @@ Kirigami.Page { contentItem: TreeView { id: treeView topMargin: Math.round(Kirigami.Units.smallSpacing / 2) + bottomMargin: Math.round(Kirigami.Units.smallSpacing / 2) clip: true reuseItems: false @@ -147,6 +148,17 @@ Kirigami.Page { selectionModel: ItemSelectionModel {} + // This is somewhat of a hack. + // If we don't calculate this for TableView, then the content area doesn't quite scroll down far enough to cover the margins. + rowHeightProvider: row => { + // NOTE: This padding value should be kept in sync with the padding value of our delegates. + const padding = Kirigami.Units.mediumSpacing; + // NOTE: This calculation should be kept in sync with the height value of our delegates. + return Kirigami.Units.gridUnit + (NeoChatConfig.compactRoomList ? 0 : Kirigami.Units.largeSpacing * 2) + padding * 2; + } + + // NOTE: For any future delegate spelunkers, please *keep the delegate heights in sync*. + // If you fail to do so, weird scrolling behavior begins to manifest. delegate: DelegateChooser { role: "delegateType" @@ -181,8 +193,8 @@ Kirigami.Page { delegate: Delegates.RoundedItemDelegate { text: i18nc("@action:button", "Find your friends") icon.name: "list-add-user" - icon.width: Kirigami.Units.gridUnit * 2 - icon.height: Kirigami.Units.gridUnit * 2 + icon.width: Kirigami.Units.gridUnit + (NeoChatConfig.compactRoomList ? 0 : Kirigami.Units.largeSpacing * 2) + icon.height: Kirigami.Units.gridUnit + (NeoChatConfig.compactRoomList ? 0 : Kirigami.Units.largeSpacing * 2) onClicked: (Kirigami.PageStack.pageStack as Kirigami.PageRow).pushDialogLayer(Qt.createComponent('org.kde.neochat', 'UserSearchPage'), { connection: root.connection diff --git a/src/rooms/RoomTreeSection.qml b/src/rooms/RoomTreeSection.qml index 10b479da7..a3e08a4ac 100644 --- a/src/rooms/RoomTreeSection.qml +++ b/src/rooms/RoomTreeSection.qml @@ -6,8 +6,11 @@ import QtQuick.Controls as QQC2 import QtQuick.Layouts import org.kde.kirigami as Kirigami +import org.kde.kirigamiaddons.delegates as Delegates -QQC2.ItemDelegate { +import org.kde.neochat + +Delegates.RoundedItemDelegate { id: root required property TreeView treeView @@ -36,29 +39,31 @@ QQC2.ItemDelegate { Keys.onSpacePressed: root.treeView.toggleExpanded(row) contentItem: Item { - implicitWidth: layout.implicitWidth - implicitHeight: layout.implicitHeight + implicitHeight: Math.max(layout.implicitHeight, Kirigami.Units.gridUnit + (NeoChatConfig.compactRoomList ? 0 : Kirigami.Units.largeSpacing * 2)) RowLayout { id: layout - width: root.contentItem.width + anchors.fill: parent spacing: 0 Kirigami.ListSectionHeader { - Layout.fillWidth: true visible: !root.collapsed horizontalPadding: 0 topPadding: 0 bottomPadding: 0 text: root.collapsed ? "" : root.displayName - onClicked: root.treeView.toggleExpanded(row) + onClicked: root.treeView.toggleExpanded(root.row) + + Layout.fillWidth: true + Layout.alignment: Qt.AlignVCenter } QQC2.ToolButton { id: collapseButton - Layout.alignment: Qt.AlignHCenter + + Layout.alignment: Qt.AlignCenter icon { name: root.expanded ? "go-up" : "go-down"