mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-03 20:35:13 +00:00
qt history: fix slowness
arghhhhh finalllllllllllly figured it out...
This commit is contained in:
parent
e35ed17200
commit
b0631f90f8
2 changed files with 9 additions and 3 deletions
|
@ -96,9 +96,8 @@ class HistoryModel(QAbstractItemModel, PrintError):
|
|||
return self.createIndex(row, column)
|
||||
|
||||
def data(self, index: QModelIndex, role: Qt.ItemDataRole):
|
||||
# requires PyQt5 5.11
|
||||
# indexIsValid = QAbstractItemModel.CheckIndexOptions(QAbstractItemModel.CheckIndexOption.IndexIsValid.value)
|
||||
# assert self.checkIndex(index, indexIsValid)
|
||||
# note: this method is performance-critical.
|
||||
# it is called a lot, and so must run extremely fast.
|
||||
assert index.isValid()
|
||||
col = index.column()
|
||||
tx_item = self.transactions.value_from_pos(index.row())
|
||||
|
|
|
@ -444,6 +444,13 @@ class MyTreeView(QTreeView):
|
|||
self.setRootIsDecorated(False) # remove left margin
|
||||
self.toolbar_shown = False
|
||||
|
||||
# When figuring out the size of columns, Qt by default looks at
|
||||
# the first 1000 rows (at least if resize mode is QHeaderView.ResizeToContents).
|
||||
# This would be REALLY SLOW, and it's not perfect anyway.
|
||||
# So to speed the UI up considerably, set it to
|
||||
# only look at as many rows as currently visible.
|
||||
self.header().setResizeContentsPrecision(0)
|
||||
|
||||
def set_editability(self, items):
|
||||
for idx, i in enumerate(items):
|
||||
i.setEditable(idx in self.editable_columns)
|
||||
|
|
Loading…
Add table
Reference in a new issue