From adbabacc12500994e0bdf78b76f66ce91baf085c Mon Sep 17 00:00:00 2001 From: ThomasV Date: Tue, 24 May 2022 19:54:27 +0200 Subject: [PATCH] Stabilize size of receive_tabs widgets - use SetMinimumSize instead of sizeHint (partially reverts 28f794b63b180d1b10432b3f822f5c8b0a7375ec) - to deal with small window sizes, set MinimumHeight of the parent TabWidget (with a few extra pixels for margins) - add an extra layout around address_help_text, so that it has margins (margins were removed in 28f794b63b180d1b10432b3f822f5c8b0a7375ec) --- electrum/gui/qt/main_window.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index 7648d6e15..7d415ecaa 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -1200,11 +1200,15 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): grid.addLayout(buttons, 4, 0, 1, -1) self.receive_address_e = ButtonsTextEdit() - self.receive_address_help = WWLabel('') + self.receive_address_help_text = WWLabel('') + vbox = QVBoxLayout() + vbox.addWidget(self.receive_address_help_text) + self.receive_address_help = QWidget() self.receive_address_help.setVisible(False) + self.receive_address_help.setLayout(vbox) + self.receive_URI_e = ButtonsTextEdit() self.receive_lightning_e = ButtonsTextEdit() - self.receive_lightning_help_text = WWLabel('') self.receive_rebalance_button = QPushButton('Rebalance') self.receive_rebalance_button.suggestion = None @@ -1238,11 +1242,11 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): e.setFont(QFont(MONOSPACE_FONT)) e.addCopyButton(self.app) e.setReadOnly(True) - e.sizeHint = lambda: min_size + e.setMinimumSize(min_size) for w in [self.receive_address_help, self.receive_lightning_help]: - w.sizeHint = lambda: min_size + w.setMinimumSize(min_size) for w in [self.receive_address_qr, self.receive_URI_qr, self.receive_lightning_qr]: - w.sizeHint = lambda: min_size + w.setMinimumSize(min_size) self.receive_lightning_e.textChanged.connect(self.update_receive_widgets) @@ -1263,6 +1267,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): from .util import VTabWidget self.receive_tabs = VTabWidget() + self.receive_tabs.setMinimumHeight(min_size.height() + 4) # for margins receive_address_widget = QWidget() receive_address_widget.setLayout(receive_address_layout) receive_URI_widget = QWidget() @@ -1379,7 +1384,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): self.receive_address_e.setText(addr) self.update_receive_address_styling() self.receive_address_qr.setData(addr) - self.receive_address_help.setText(address_help) + self.receive_address_help_text.setText(address_help) self.receive_URI_e.setText(URI) self.receive_URI_qr.setData(URI) self.receive_lightning_e.setText(lnaddr) # TODO maybe prepend "lightning:" ??