From 6ae105ca99c0fe865c8d2c894e651bffac96e528 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Fri, 3 Feb 2023 15:17:42 +0000 Subject: [PATCH] qt tx dialog: fix size of IO textedits when resizing textedit.setMinimumWidth(950) (from 5af399d19639b0c141398db964270c4974f124acdoes) does not play well with the tx_dlg.setMinimumWidth(640) when resizing. Make 950 only affect the default sizing of the textedit. --- electrum/gui/qt/transaction_dialog.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/electrum/gui/qt/transaction_dialog.py b/electrum/gui/qt/transaction_dialog.py index 2bdd3d307..189a7fb73 100644 --- a/electrum/gui/qt/transaction_dialog.py +++ b/electrum/gui/qt/transaction_dialog.py @@ -82,8 +82,12 @@ class TxFiatLabel(QLabel): self.setText(('≈ %s' % fiat_fee) if fiat_fee else '') class QTextBrowserWithDefaultSize(QTextBrowser): + def __init__(self, width: int = 0, height: int = 0): + self._width = width + self._height = height + QTextBrowser.__init__(self) def sizeHint(self): - return QSize(0, 100) + return QSize(self._width, self._height) class TxInOutWidget(QWidget): @@ -94,7 +98,7 @@ class TxInOutWidget(QWidget): self.main_window = main_window self.tx = None # type: Optional[Transaction] self.inputs_header = QLabel() - self.inputs_textedit = QTextBrowserWithDefaultSize() + self.inputs_textedit = QTextBrowserWithDefaultSize(950, 100) self.inputs_textedit.setOpenLinks(False) # disable automatic link opening self.inputs_textedit.anchorClicked.connect(self._open_internal_link) # send links to our handler self.inputs_textedit.setTextInteractionFlags( @@ -108,7 +112,7 @@ class TxInOutWidget(QWidget): self.txo_color_2fa = TxOutputColoring( legend=_("TrustedCoin (2FA) batch fee"), color=ColorScheme.BLUE, tooltip=_("TrustedCoin (2FA) fee for the next batch of transactions")) self.outputs_header = QLabel() - self.outputs_textedit = QTextBrowserWithDefaultSize() + self.outputs_textedit = QTextBrowserWithDefaultSize(950, 100) self.outputs_textedit.setOpenLinks(False) # disable automatic link opening self.outputs_textedit.anchorClicked.connect(self._open_internal_link) # send links to our handler self.outputs_textedit.setTextInteractionFlags( @@ -116,9 +120,6 @@ class TxInOutWidget(QWidget): self.outputs_textedit.setContextMenuPolicy(Qt.CustomContextMenu) self.outputs_textedit.customContextMenuRequested.connect(self.on_context_menu_for_outputs) - self.inputs_textedit.setMinimumWidth(950) - self.outputs_textedit.setMinimumWidth(950) - outheader_hbox = QHBoxLayout() outheader_hbox.setContentsMargins(0, 0, 0, 0) outheader_hbox.addWidget(self.outputs_header)