From 90d321f0ffb3202c8a7c18298dd5871992ecb86a Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 17 Oct 2018 06:28:53 -0400 Subject: Mobile/filtering: add count of filtered dives to search bar The count in the trip headers is still that for the complete trip and therefore misleading. Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/DiveList.qml | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml index b2dde0cd0..8dd8dd010 100644 --- a/mobile-widgets/qml/DiveList.qml +++ b/mobile-widgets/qml/DiveList.qml @@ -366,15 +366,38 @@ Kirigami.ScrollablePage { Component { id: filterHeader - Controls.TextField { - id: sitefilter - visible: (opacity > 0) && rootItem.filterToggle - text: "" - placeholderText: "Dive site name" - onTextChanged: { - rootItem.filterPattern = text - diveModel.setFilter(text) + RowLayout { + anchors.left: parent.left + anchors.right: parent.right + visible: rootItem.filterToggle + height: rootItem.filterToggle ? sitefilter.implicitHeight * 1.1 : 0 + Rectangle { + width: Kirigami.Units.gridUnit / 4 + } + onVisibleChanged: numShown.text = diveModel.shown() + Controls.TextField { + id: sitefilter + verticalAlignment: TextInput.AlignVCenter + text: "" + placeholderText: "Full text search" + onTextChanged: { + rootItem.filterPattern = text + diveModel.setFilter(text) + numShown.text = diveModel.shown() + } + } + Controls.Label { + id: numShown + verticalAlignment: Text.AlignVCenter + // when this is first rendered, the model is still empty, so + // instead of having a misleading 0 here, just don't show a count + // it gets set whenever visibility or the search text changes + text: "" } + Rectangle { + width: Kirigami.Units.regularSpacing + } + } } -- cgit v1.2.3-70-g09d2