From 9924b0565a97dd232e9c9df3da7608dc10924d6c Mon Sep 17 00:00:00 2001 From: miruka Date: Sun, 11 Aug 2019 22:57:36 -0400 Subject: [PATCH] Fix RoomDelegates v padding when collapsed --- src/qml/SidePane/RoomDelegate.qml | 95 +++++++++++++++---------------- 1 file changed, 46 insertions(+), 49 deletions(-) diff --git a/src/qml/SidePane/RoomDelegate.qml b/src/qml/SidePane/RoomDelegate.qml index 2fc950f8..fcf7f41a 100644 --- a/src/qml/SidePane/RoomDelegate.qml +++ b/src/qml/SidePane/RoomDelegate.qml @@ -6,69 +6,66 @@ import "../utils.js" as Utils HInteractiveRectangle { id: roomDelegate width: roomList.width - height: childrenRect.height + height: rowLayout.height color: theme.sidePane.room.background TapHandler { onTapped: pageStack.showRoom(userId, model.room_id) } - Row { - width: parent.width - leftPadding * 2 - padding: sidePane.currentSpacing / 2 - leftPadding: sidePane.currentSpacing - rightPadding: 0 + HRowLayout { + id: rowLayout + x: sidePane.currentSpacing + width: parent.width - sidePane.currentSpacing * 1.5 + height: roomLabel.height + subtitleLabel.height + + sidePane.currentSpacing / 1.5 + spacing: sidePane.currentSpacing - HRowLayout { - width: parent.width - spacing: sidePane.currentSpacing + HRoomAvatar { + id: roomAvatar + displayName: model.display_name + avatarUrl: model.avatar_url + } - HRoomAvatar { - id: roomAvatar - displayName: model.display_name - avatarUrl: model.avatar_url + HColumnLayout { + Layout.fillWidth: true + + HLabel { + id: roomLabel + color: theme.sidePane.room.name + text: model.display_name || "Empty room" + textFormat: + model.display_name? Text.PlainText : Text.StyledText + elide: Text.ElideRight + verticalAlignment: Qt.AlignVCenter + + Layout.fillWidth: true } - HColumnLayout { - Layout.fillWidth: true + HRichLabel { + id: subtitleLabel + color: theme.sidePane.room.subtitle + visible: Boolean(text) + textFormat: Text.StyledText - HLabel { - id: roomLabel - color: theme.sidePane.room.name - text: model.display_name || "Empty room" - textFormat: - model.display_name? Text.PlainText : Text.StyledText - elide: Text.ElideRight - verticalAlignment: Qt.AlignVCenter + text: { + if (! model.last_event) { return "" } - Layout.fillWidth: true - } + let ev = model.last_event - HRichLabel { - id: subtitleLabel - color: theme.sidePane.room.subtitle - visible: Boolean(text) - textFormat: Text.StyledText - - text: { - if (! model.last_event) { return "" } - - let ev = model.last_event - - if (ev.event_type === "RoomMessageEmote" || - ! ev.event_type.startsWith("RoomMessage")) { - return Utils.processedEventText(ev) - } - - return Utils.coloredNameHtml( - ev.sender_name, ev.sender_id - ) + ": " + ev.inline_content + if (ev.event_type === "RoomMessageEmote" || + ! ev.event_type.startsWith("RoomMessage")) { + return Utils.processedEventText(ev) } - - font.pixelSize: theme.fontSize.small - elide: Text.ElideRight - - Layout.fillWidth: true + return Utils.coloredNameHtml( + ev.sender_name, ev.sender_id + ) + ": " + ev.inline_content } + + + font.pixelSize: theme.fontSize.small + elide: Text.ElideRight + + Layout.fillWidth: true } } }