electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 84797f90d0d8e6f58ec2186cefbf5685daa09480
parent 4c2e1970f260a9688f7bf528657f0e1351b73ee3
Author: SomberNight <somber.night@protonmail.com>
Date:   Sun, 23 Feb 2020 21:23:56 +0100

qt request_list: clear receive addr/req when hiding list

Diffstat:
Melectrum/gui/qt/request_list.py | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/electrum/gui/qt/request_list.py b/electrum/gui/qt/request_list.py @@ -24,6 +24,7 @@ # SOFTWARE. from enum import IntEnum +from typing import Optional from PyQt5.QtGui import QStandardItemModel, QStandardItem from PyQt5.QtWidgets import QMenu @@ -75,7 +76,11 @@ class RequestList(MyTreeView): self.selectionModel().setCurrentIndex(item, QItemSelectionModel.SelectCurrent | QItemSelectionModel.Rows) break - def item_changed(self, idx: QModelIndex): + def item_changed(self, idx: Optional[QModelIndex]): + if idx is None: + self.parent.receive_payreq_e.setText('') + self.parent.receive_address_e.setText('') + return if not idx.isValid(): return # TODO use siblingAtColumn when min Qt version is >=5.11 @@ -152,6 +157,9 @@ class RequestList(MyTreeView): b = self.model().rowCount() > 0 self.setVisible(b) self.parent.receive_requests_label.setVisible(b) + if not b: + # list got hidden, so selected item should also be cleared: + self.item_changed(None) def create_menu(self, position): idx = self.indexAt(position)