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 tristate: true
checkState: checkState:
sectionTotalCount === sectionCheckedCount ? Qt.Checked :
! sectionCheckedCount ? Qt.Unchecked : ! sectionCheckedCount ? Qt.Unchecked :
sectionTotalCount === sectionCheckedCount ? Qt.Checked :
Qt.PartiallyChecked Qt.PartiallyChecked
nextCheckState: nextCheckState:

View File

@ -26,6 +26,7 @@ HColumnPage {
deviceList.model.append(device) 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 { footer: ButtonLayout {
visible: height >= 0 visible: height >= 0
@ -61,17 +73,7 @@ HColumnPage {
HListView { HListView {
id: deviceList id: deviceList
readonly property var sectionItemCounts: { property var sectionItemCounts: getSectionItemCounts()
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
}
clip: true clip: true
model: ListModel {} model: ListModel {}