Hide expand arrows when rooms are filtering

Any account with matching rooms is expanded until there is no more
active filter.
This commit is contained in:
miruka 2019-08-17 15:42:56 -04:00
parent c5d5768f2e
commit bfbcc73c43
2 changed files with 11 additions and 3 deletions

View File

@ -8,9 +8,10 @@ Column {
spacing: theme.spacing / 2
opacity:
paneToolBar.roomFilter && roomList.model.count < 1 ? 0.35 : 1
paneToolBar.roomFilter && roomList.model.count < 1 ? 0.3 : 1
Behavior on opacity { HNumberAnimation {} }
property bool forceExpand: paneToolBar.roomFilter && roomList.model.count
property bool expanded: true
readonly property var modelItem: model
@ -59,6 +60,7 @@ Column {
ExpandButton {
id: expandButton
opacity: paneToolBar.roomFilter ? 0 : 1
expandableItem: accountDelegate
Layout.preferredHeight: row.height
}
@ -69,7 +71,9 @@ Column {
id: roomList
visible: height > 0
width: parent.width
height: childrenRect.height * (accountDelegate.expanded ? 1 : 0)
height:
childrenRect.height *
(accountDelegate.expanded || accountDelegate.forceExpand ? 1 : 0)
clip: heightAnimation.running
userId: modelItem.user_id

View File

@ -10,10 +10,14 @@ HUIButton {
backgroundColor: "transparent"
onClicked: expandableItem.expanded = ! expandableItem.expanded
visible: opacity > 0
opacity: expandableItem.forceExpand ? 0 : 1
Behavior on opacity { HNumberAnimation {} }
iconTransform: Rotation {
origin.x: expandButton.iconDimension / 2
origin.y: expandButton.iconDimension / 2
angle: expandableItem.expanded ? 90 : 180
angle: expandableItem.expanded || expandableItem.forceExpand ? 90 : 180
Behavior on angle { HNumberAnimation {} }
}
}