moment/src/qml/SidePane/AccountDelegate.qml

83 lines
2.1 KiB
QML
Raw Normal View History

import QtQuick 2.7
import QtQuick.Layouts 1.3
import "../Base"
2019-03-22 14:28:14 +11:00
Column {
id: accountDelegate
width: parent.width
2019-03-22 14:28:14 +11:00
// Avoid binding loop by using Component.onCompleted
property var user: null
Component.onCompleted: user = models.users.getUser(userId)
property string roomCategoriesListUserId: userId
property bool expanded: true
HRowLayout {
width: parent.width
height: childrenRect.height
id: row
2019-03-26 09:29:46 +11:00
HAvatar {
id: avatar
name: user.displayName
}
2019-03-26 09:29:46 +11:00
HColumnLayout {
Layout.fillWidth: true
Layout.fillHeight: true
2019-03-26 09:29:46 +11:00
HLabel {
id: accountLabel
text: user.displayName || user.userId
2019-04-29 05:36:43 +10:00
elide: HLabel.ElideRight
2019-03-26 09:29:46 +11:00
maximumLineCount: 1
Layout.fillWidth: true
leftPadding: 6
rightPadding: leftPadding
2019-03-26 09:29:46 +11:00
}
HTextField {
id: statusEdit
text: user.statusMessage || ""
2019-03-26 09:29:46 +11:00
placeholderText: qsTr("Set status message")
font.pixelSize: HStyle.fontSize.small
background: null
padding: 0
leftPadding: accountLabel.leftPadding
rightPadding: leftPadding
Layout.fillWidth: true
onEditingFinished: {
//Backend.setStatusMessage(userId, text)
pageStack.forceActiveFocus()
}
}
}
2019-03-26 09:29:46 +11:00
ExpandButton {
expandableItem: accountDelegate
Layout.preferredHeight: row.height
2019-03-22 14:28:14 +11:00
}
}
RoomCategoriesList {
id: roomCategoriesList
interactive: false // no scrolling
visible: height > 0
width: parent.width
height: childrenRect.height * (accountDelegate.expanded ? 1 : 0)
clip: heightAnimation.running
userId: roomCategoriesListUserId
Behavior on height {
2019-05-15 05:15:10 +10:00
NumberAnimation {
id: heightAnimation;
duration: HStyle.animationDuration
}
}
}
2019-03-22 14:28:14 +11:00
}