Make room pane resizable, spacing between accounts

This commit is contained in:
miruka 2019-03-22 20:45:22 -04:00
parent 65a9e420bf
commit 12f14a6a7d
3 changed files with 42 additions and 28 deletions

View File

@ -2,27 +2,35 @@ import QtQuick 2.7
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import QtQuick.Layouts 1.4 import QtQuick.Layouts 1.4
Rectangle { Column {
readonly property string displayName: readonly property string displayName:
Backend.getUser(section).display_name Backend.getUser(section).display_name
color: "#111"
width: roomListView.width width: roomListView.width
height: childrenRect.height height: paddingItem.height + row.height
RowLayout { Item { id: paddingItem; width: 1; height: row.height / 2 }
Row {
id: row id: row
spacing: 1
width: parent.width width: parent.width
height: avatar.height
Avatar { id: avatar; username: displayName } Avatar { id: avatar; username: displayName }
Rectangle {
color: "#111"
width: parent.width - avatar.width
height: parent.height
ColumnLayout { ColumnLayout {
anchors.fill: parent
spacing: 1 spacing: 1
PlainLabel { PlainLabel {
id: accountLabel id: accountLabel
text: displayName text: displayName
horizontalAlignment: Qt.AlignHCenter
color: "#CCC" color: "#CCC"
elide: Text.ElideRight elide: Text.ElideRight
maximumLineCount: 1 maximumLineCount: 1
@ -41,3 +49,4 @@ Rectangle {
} }
} }
} }
}

View File

@ -4,12 +4,17 @@ import QtQuick.Layouts 1.4
Rectangle { Rectangle {
id: roomPane id: roomPane
Layout.preferredWidth: 150 width: 180
Layout.minimumWidth: 48
Layout.fillHeight: true Layout.fillHeight: true
color: "gray" color: "gray"
clip: true // Avoid artifacts when resizing pane width to minimum
Column { Column {
anchors.fill: parent x: parent.x
y: parent.y - 48 / 2
width: parent.width
height: parent.height + 48 / 2
ListView { ListView {
width: parent.width width: parent.width
height: parent.height - actionBar.height height: parent.height - actionBar.height

View File

@ -1,9 +1,9 @@
import QtQuick.Controls 1.4 as Controls1
import QtQuick.Controls 2.2 import QtQuick.Controls 2.2
import QtQuick.Layouts 1.4 import QtQuick.Layouts 1.4
RowLayout { Controls1.SplitView {
anchors.fill: parent anchors.fill: parent
spacing: 0
RoomPane {} RoomPane {}