Add expand/search button to room pane when narrow

This commit is contained in:
miruka 2020-07-14 04:54:23 -04:00
parent fea1a8df4c
commit e5f147e977
2 changed files with 54 additions and 31 deletions

View File

@ -65,11 +65,12 @@ HColumnLayout {
color: theme.chat.roomPane.bottomBar.background
Layout.fillWidth: true
Layout.minimumHeight: theme.baseElementsHeight
Layout.maximumHeight: Layout.minimumHeight
Layout.preferredHeight: childrenRect.height
HRowLayout {
anchors.fill: parent
width: parent.width
layoutDirection:
expandButton.visible ? Qt.RightToLeft : Qt.LeftToRight
HTextField {
id: filterField
@ -82,7 +83,6 @@ HColumnLayout {
opacity: width >= 16 * theme.uiScale ? 1 : 0
Layout.fillWidth: true
Layout.fillHeight: true
// FIXME: fails to display sometimes for some reason if
// declared normally
@ -124,6 +124,7 @@ HColumnLayout {
Behavior on opacity { HNumberAnimation {} }
}
HColumnLayout {
HButton {
id: inviteButton
icon.name: "room-send-invite"
@ -149,7 +150,7 @@ HColumnLayout {
},
)
Layout.fillHeight: true
Layout.preferredHeight: filterField.implicitHeight
HShortcut {
sequences: window.settings.keys.inviteToRoom
@ -157,6 +158,25 @@ HColumnLayout {
if (inviteButton.enabled) inviteButton.clicked()
}
}
HButton {
id: expandButton
icon.name: "room-pane-expand-search"
backgroundColor: inviteButton.backgroundColor
toolTip.text: qsTr("Expand search")
visible: Layout.preferredHeight > 0
// Will trigger roomPane.requireDefaultSize
onClicked: filterField.forceActiveFocus()
Layout.preferredHeight:
filterField.width < 32 * theme.uiScale ?
filterField.implicitHeight :
0
Behavior on Layout.preferredHeight { HNumberAnimation {} }
}
}
}
}
}

View File

@ -0,0 +1,3 @@
<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="m23.809 21.646-6.205-6.205c1.167-1.605 1.857-3.579 1.857-5.711 0-5.365-4.365-9.73-9.731-9.73-5.365 0-9.73 4.365-9.73 9.73 0 5.366 4.365 9.73 9.73 9.73 2.034 0 3.923-.627 5.487-1.698l6.238 6.238zm-20.955-11.916c0-3.792 3.085-6.877 6.877-6.877s6.877 3.085 6.877 6.877-3.085 6.877-6.877 6.877c-3.793 0-6.877-3.085-6.877-6.877z"/>
</svg>

After

Width:  |  Height:  |  Size: 431 B