commit 1ea4e42a96f1dfc8aeb89dc8079cafcf7837e008
parent caa68e2fe81bd5d9d068393b220db02c5e0ba621
Author: SomberNight <somber.night@protonmail.com>
Date: Wed, 16 Sep 2020 18:26:08 +0200
Qt history/address tab: defer refreshing while editing (e.g. label)
This functionality was originally added in 0371a3dc32350c1923348c216ee2c2f8eee2d4d1,
but was lost with #4915 in version 3.3.
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/electrum/gui/qt/util.py b/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