Fixed anchoring/positioning of delegate items and join room display

This commit is contained in:
kamathmanu 2021-08-03 18:26:11 -04:00
parent d3d7844106
commit 98b733ad26

View file

@ -62,7 +62,7 @@ ApplicationWindow {
property color background: Nheko.colors.window property color background: Nheko.colors.window
property color importantText: Nheko.colors.text property color importantText: Nheko.colors.text
property color unimportantText: Nheko.colors.buttonText property color unimportantText: Nheko.colors.buttonText
property int avatarSize: Math.ceil(fontMetrics.lineSpacing * 2.5) property int avatarSize: Math.ceil(fontMetrics.lineSpacing * 4)
color: background color: background
@ -115,13 +115,14 @@ ApplicationWindow {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredWidth: parent.width Layout.preferredWidth: parent.width
spacing: Nheko.paddingSmall spacing: Nheko.paddingSmall
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
Layout.preferredHeight: Math.max(roomTopic.height, roomCount.height, joinRoomButton.height) Layout.preferredHeight: Math.ceil(fontMetrics.lineSpacing * 4)
Label { Label {
id: roomTopic id: roomTopic
color: roomDirDelegate.unimportantText color: roomDirDelegate.unimportantText
font.weight: Font.Thin font.weight: Font.Thin
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
font.pixelSize: fontMetrics.font.pixelSize font.pixelSize: fontMetrics.font.pixelSize
elide: Text.ElideRight elide: Text.ElideRight
maximumLineCount: 2 maximumLineCount: 2
@ -130,21 +131,34 @@ ApplicationWindow {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
} }
Item {
id: numMembersRectangle
Layout.fillWidth: false
Layout.margins: Nheko.paddingSmall
width: roomCount.width
Label { Label {
id: roomCount id: roomCount
color: roomDirDelegate.unimportantText color: roomDirDelegate.unimportantText
anchors.centerIn: parent
Layout.fillWidth: false Layout.fillWidth: false
font.weight: Font.Thin font.weight: Font.Thin
font.pixelSize: fontMetrics.font.pixelSize font.pixelSize: fontMetrics.font.pixelSize
text: model.numMembers.toString() text: model.numMembers.toString()
} }
}
Item {
id: buttonRectangle
Layout.fillWidth: false
Layout.margins: Nheko.paddingSmall
width: joinRoomButton.width
Button { Button {
id: joinRoomButton id: joinRoomButton
Layout.fillWidth: false visible: roomDir.canJoinRoom(model.roomid)
anchors.centerIn: parent
width: Math.ceil(0.1 * roomDirectoryWindow.width)
text: "Join" text: "Join"
Layout.margins: Nheko.paddingSmall
onClicked: roomDir.joinRoom(model.index) onClicked: roomDir.joinRoom(model.index)
} }
} }
@ -152,4 +166,5 @@ ApplicationWindow {
} }
} }
} }
}
} }