Reload section item counts on verify/blacklist

This commit is contained in:
miruka 2020-06-26 02:20:12 -04:00
parent edc73c6952
commit cddf4ac2fe
2 changed files with 15 additions and 13 deletions

View File

@ -31,8 +31,8 @@ HRowLayout {
tristate: true
checkState:
sectionTotalCount === sectionCheckedCount ? Qt.Checked :
! sectionCheckedCount ? Qt.Unchecked :
sectionTotalCount === sectionCheckedCount ? Qt.Checked :
Qt.PartiallyChecked
nextCheckState:

View File

@ -25,7 +25,8 @@ HColumnPage {
for (const device of devices)
deviceList.model.append(device)
loadFuture = null
loadFuture = null
deviceList.sectionItemCounts = getSectionItemCounts()
})
}
@ -39,6 +40,17 @@ HColumnPage {
})
}
function getSectionItemCounts() {
const counts = {}
for (let i = 0; i < deviceList.model.count; i++) {
const section = deviceList.model.get(i).type
section in counts ? counts[section] += 1 : counts[section] = 1
}
return counts
}
footer: ButtonLayout {
visible: height >= 0
@ -61,17 +73,7 @@ HColumnPage {
HListView {
id: deviceList
readonly property var sectionItemCounts: {
const counts = {}
for (let i = 0; i < count; i++) {
const section = model.get(i).type
section in counts ? counts[section] += 1 : counts[section] = 1
}
print( "rec")
return counts
}
property var sectionItemCounts: getSectionItemCounts()
clip: true
model: ListModel {}