feat: enable filtering the channels with the search

Fixes #59
This commit is contained in:
Jonathan Rainville 2020-05-19 16:23:22 -04:00 committed by Iuri Matias
parent 26d7cacaea
commit 959f8277ce
1 changed files with 9 additions and 3 deletions

View File

@ -6,6 +6,8 @@ import Qt.labs.platform 1.1
import "../../imports" import "../../imports"
SplitView { SplitView {
property alias searchStr: searchText.text
id: chatView id: chatView
x: 0 x: 0
y: 0 y: 0
@ -18,6 +20,7 @@ SplitView {
anchors.leftMargin: 0 anchors.leftMargin: 0
Item { Item {
id: contactsColumn id: contactsColumn
width: 300 width: 300
height: parent.height height: parent.height
@ -127,7 +130,6 @@ SplitView {
Rectangle { Rectangle {
id: wrapper id: wrapper
height: 64
color: ListView.isCurrentItem ? Theme.lightBlue : Theme.transparent color: ListView.isCurrentItem ? Theme.lightBlue : Theme.transparent
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: Theme.padding anchors.rightMargin: Theme.padding
@ -136,10 +138,14 @@ SplitView {
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: Theme.padding anchors.leftMargin: Theme.padding
radius: 8 radius: 8
// Hide the box if it is filtered out
property bool isVisible: searchStr == "" || name.includes(searchStr)
visible: isVisible ? true : false
height: isVisible ? 64 : 0
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: listView.currentIndex = index onClicked: chatGroupsListView.currentIndex = index
} }
Rectangle { Rectangle {
@ -214,7 +220,7 @@ SplitView {
} }
ListView { ListView {
id: listView id: chatGroupsListView
anchors.topMargin: 24 anchors.topMargin: 24
anchors.fill: parent anchors.fill: parent
model: chatsModel model: chatsModel