Remove account collapse bug workaround
Unable to reproduce the bug where collapsing an account with lots of rooms corrupts the ListView, did updating to Qt 5.14.2 do something? With the workaround removed, the 0.2s delay when removing batch of ListView items (e.g. when filtering) is gone.
This commit is contained in:
parent
de894ab4bb
commit
b399de6776
|
@ -1,7 +1,6 @@
|
|||
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
import itertools
|
||||
import time
|
||||
from bisect import bisect
|
||||
from contextlib import contextmanager
|
||||
from threading import RLock
|
||||
|
@ -194,22 +193,13 @@ class Model(MutableMapping):
|
|||
yield None
|
||||
finally:
|
||||
indice = self._active_batch_remove_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]
|
||||
groups = [
|
||||
list(group) for item, group in itertools.groupby(indice)
|
||||
]
|
||||
|
||||
for grp in groups:
|
||||
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)
|
||||
ModelItemDeleted(
|
||||
self.sync_id, index=grp[0], count=len(grp),
|
||||
)
|
||||
|
||||
self._active_batch_remove_indice = None
|
||||
|
|
Loading…
Reference in New Issue
Block a user