Reload section item counts on verify/blacklist
This commit is contained in:
parent
edc73c6952
commit
cddf4ac2fe
|
@ -31,8 +31,8 @@ HRowLayout {
|
|||
tristate: true
|
||||
|
||||
checkState:
|
||||
sectionTotalCount === sectionCheckedCount ? Qt.Checked :
|
||||
! sectionCheckedCount ? Qt.Unchecked :
|
||||
sectionTotalCount === sectionCheckedCount ? Qt.Checked :
|
||||
Qt.PartiallyChecked
|
||||
|
||||
nextCheckState:
|
||||
|
|
|
@ -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 {}
|
||||
|
|
Loading…
Reference in New Issue
Block a user