From bfbcc73c431375d206f59d2aaa9f3eb40fe9b171 Mon Sep 17 00:00:00 2001 From: miruka Date: Sat, 17 Aug 2019 15:42:56 -0400 Subject: [PATCH] Hide expand arrows when rooms are filtering Any account with matching rooms is expanded until there is no more active filter. --- src/qml/SidePane/AccountDelegate.qml | 8 ++++++-- src/qml/SidePane/ExpandButton.qml | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/qml/SidePane/AccountDelegate.qml b/src/qml/SidePane/AccountDelegate.qml index 4ab22675..89f7b2e9 100644 --- a/src/qml/SidePane/AccountDelegate.qml +++ b/src/qml/SidePane/AccountDelegate.qml @@ -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 diff --git a/src/qml/SidePane/ExpandButton.qml b/src/qml/SidePane/ExpandButton.qml index 3a751818..c2f169c6 100644 --- a/src/qml/SidePane/ExpandButton.qml +++ b/src/qml/SidePane/ExpandButton.qml @@ -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 {} } } }