Mobile/filtering: implement the filter update through a thread

It's important to disconnect the model from the ListView, otherwise the update in a
different thread will fail.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2018-10-20 12:04:00 -04:00
parent 84822ebd2f
commit cf3fcc53b6
2 changed files with 7 additions and 2 deletions

View file

@ -411,8 +411,7 @@ Kirigami.ScrollablePage {
text: "" text: ""
placeholderText: "Full text search" placeholderText: "Full text search"
onAccepted: { onAccepted: {
rootItem.filterPattern = text manager.setFilter(text)
diveModel.setFilter(text)
console.log("back from setFilter") console.log("back from setFilter")
} }
onEnabledChanged: { onEnabledChanged: {
@ -451,6 +450,10 @@ Kirigami.ScrollablePage {
section.criteria: ViewSection.FullString section.criteria: ViewSection.FullString
section.delegate: tripHeading section.delegate: tripHeading
section.labelPositioning: ViewSection.CurrentLabelAtStart | ViewSection.InlineLabels section.labelPositioning: ViewSection.CurrentLabelAtStart | ViewSection.InlineLabels
onModelChanged: {
numShownText = diveModel.shown()
console.log("update number shown to " + numShownText)
}
Connections { Connections {
target: detailsWindow target: detailsWindow
onCurrentIndexChanged: diveListView.currentIndex = detailsWindow.currentIndex onCurrentIndexChanged: diveListView.currentIndex = detailsWindow.currentIndex

View file

@ -64,10 +64,12 @@ Kirigami.ApplicationWindow {
function showBusy() { function showBusy() {
busy.running = true busy.running = true
diveList.diveListModel = null
} }
function hideBusy() { function hideBusy() {
busy.running = false busy.running = false
diveList.diveListModel = diveModel
} }
function returnTopPage() { function returnTopPage() {