Browse Source

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.
patch-4
SomberNight 4 years ago
parent
commit
1ea4e42a96
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 8
      electrum/gui/qt/util.py

8
electrum/gui/qt/util.py

@ -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…
Cancel
Save