Workaround collapsing large account ListView bug
This commit is contained in:
parent
4f9ed2a77f
commit
b3b12014ee
1
TODO.md
1
TODO.md
|
@ -1,5 +1,6 @@
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
|
- timer fix thing
|
||||||
- highlight messages being responded to
|
- highlight messages being responded to
|
||||||
- highlight messages with mention
|
- highlight messages with mention
|
||||||
- add room members loading indicator
|
- add room members loading indicator
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# SPDX-License-Identifier: LGPL-3.0-or-later
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
|
||||||
import itertools
|
import itertools
|
||||||
|
import time
|
||||||
from bisect import bisect
|
from bisect import bisect
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from threading import RLock
|
from threading import RLock
|
||||||
|
@ -193,8 +194,21 @@ class Model(MutableMapping):
|
||||||
finally:
|
finally:
|
||||||
indice = self._active_batch_remove_indice
|
indice = self._active_batch_remove_indice
|
||||||
groups = [list(group) for item, group in itertools.groupby(indice)]
|
groups = [list(group) for item, group in itertools.groupby(indice)]
|
||||||
|
last = None
|
||||||
|
|
||||||
|
if groups:
|
||||||
|
last = groups[-1].pop()
|
||||||
|
if not groups[-1]:
|
||||||
|
del groups[-1]
|
||||||
|
|
||||||
for grp in groups:
|
for grp in groups:
|
||||||
ModelItemDeleted(self.sync_id, index=grp[0], count=len(grp))
|
ModelItemDeleted(self.sync_id, index=grp[0], count=len(grp))
|
||||||
|
|
||||||
|
# Seems QML ListView has an horrible bug where removing a large
|
||||||
|
# amount of items at once will result in a corrupted empty display,
|
||||||
|
# this dumb workaround is the only way I've found
|
||||||
|
if last:
|
||||||
|
time.sleep(0.2)
|
||||||
|
ModelItemDeleted(self.sync_id, index=last, count=1)
|
||||||
|
|
||||||
self._active_batch_remove_indice = None
|
self._active_batch_remove_indice = None
|
||||||
|
|
Loading…
Reference in New Issue
Block a user