mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 07:55:21 +01:00
Hide empty categories when filtering
When filtering the OS list, if all items in a category/sublist are filtered out then don't show the category/sublist. Also, clear the selected OS when the HW device is changed, otherwise you can get weird effects like having an incompatible (hw, os) pair selected or the highlighted OS moving when the items in the OS list change.
This commit is contained in:
parent
a29d2c9d7c
commit
9a7fc7bf3c
1 changed files with 14 additions and 0 deletions
14
src/main.qml
14
src/main.qml
|
@ -1444,6 +1444,11 @@ ApplicationWindow {
|
|||
|
||||
if ("subitems" in entry) {
|
||||
filterItems(entry["subitems"], tags, hwTagMatchingType)
|
||||
|
||||
// If this sub-list has no items then hide it
|
||||
if (entry["subitems"].length == 0) {
|
||||
list.splice(i, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1655,6 +1660,15 @@ ApplicationWindow {
|
|||
}
|
||||
})
|
||||
|
||||
// When the HW device is changed, reset the OS selection otherwise
|
||||
// you get a weird effect with the selection moving around in the list
|
||||
// when the user next opens the OS list, and the user could still have
|
||||
// an OS selected which isn't compatible with this HW device
|
||||
oslist.currentIndex = -1
|
||||
osswipeview.currentIndex = 0
|
||||
osbutton.text = qsTr("CHOOSE OS")
|
||||
writebutton.enabled = false
|
||||
|
||||
hwbutton.text = hwmodel.name
|
||||
hwpopup.close()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue