Fix HFilter find functions

This commit is contained in:
miruka 2020-05-04 14:08:06 -04:00
parent 592a9fe8e7
commit 54b5f7b8f2
3 changed files with 6 additions and 5 deletions

View File

@ -3,6 +3,7 @@
- add account number binds
- rename goto*account → scrollto*account
- fix up/down type error when filtering
- fix opacity
- fix python error
- fix back/front buttons in small window

View File

@ -34,17 +34,17 @@ DelegateModel {
for (let i = 0; i < items.count; i++) refilterAt(i)
}
function filteredFindIndex(id) {
function filteredFindIndex(id, default_=null) {
for (let i = 0; i < filtered.count; i++)
if (filtered.get(i).id === id) return i
return null
return default_
}
function filteredFind(id) {
function filteredFind(id, default_=null) {
for (let i = 0; i < filtered.count; i++)
if (filtered.get(i).id === id) return get(i)
return null
return default_
}
}

View File

@ -32,7 +32,7 @@ HColumnLayout {
currentIndex:
roomList.currentIndex === -1 ?
-1 :
model.findIndex(
model.filteredFindIndex(
roomList.model.filtered.get(
roomList.currentIndex,
).model.for_account,