mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-05 05:15:12 +00:00
Qt history/address tab: defer refreshing while editing (e.g. label)
This functionality was originally added in 0371a3dc32
,
but was lost with #4915 in version 3.3.
This commit is contained in:
parent
caa68e2fe8
commit
1ea4e42a96
1 changed files with 7 additions and 1 deletions
|
@ -476,6 +476,9 @@ class ElectrumItemDelegate(QStyledItemDelegate):
|
|||
self.opened = None
|
||||
def on_closeEditor(editor: QLineEdit, hint):
|
||||
self.opened = None
|
||||
self.tv.is_editor_open = False
|
||||
if self.tv._pending_update:
|
||||
self.tv.update()
|
||||
def on_commitData(editor: QLineEdit):
|
||||
new_text = editor.text()
|
||||
idx = QModelIndex(self.opened)
|
||||
|
@ -489,6 +492,7 @@ class ElectrumItemDelegate(QStyledItemDelegate):
|
|||
|
||||
def createEditor(self, parent, option, idx):
|
||||
self.opened = QPersistentModelIndex(idx)
|
||||
self.tv.is_editor_open = True
|
||||
return super().createEditor(parent, option, idx)
|
||||
|
||||
|
||||
|
@ -517,6 +521,7 @@ class MyTreeView(QTreeView):
|
|||
self.editable_columns = editable_columns
|
||||
self.setItemDelegate(ElectrumItemDelegate(self))
|
||||
self.current_filter = ""
|
||||
self.is_editor_open = False
|
||||
|
||||
self.setRootIsDecorated(False) # remove left margin
|
||||
self.toolbar_shown = False
|
||||
|
@ -705,7 +710,8 @@ class MyTreeView(QTreeView):
|
|||
|
||||
def maybe_defer_update(self) -> bool:
|
||||
"""Returns whether we should defer an update/refresh."""
|
||||
defer = not self.isVisible() and not self._forced_update
|
||||
defer = (not self._forced_update
|
||||
and (not self.isVisible() or self.is_editor_open))
|
||||
# side-effect: if we decide to defer update, the state will become stale:
|
||||
self._pending_update = defer
|
||||
return defer
|
||||
|
|
Loading…
Add table
Reference in a new issue