qt StatusBarButton: use QToolButton instead of QPushButton
related: #6299
This commit is contained in:
@@ -46,7 +46,7 @@ from PyQt5.QtWidgets import (QMessageBox, QComboBox, QSystemTrayIcon, QTabWidget
|
|||||||
QHBoxLayout, QPushButton, QScrollArea, QTextEdit,
|
QHBoxLayout, QPushButton, QScrollArea, QTextEdit,
|
||||||
QShortcut, QMainWindow, QCompleter, QInputDialog,
|
QShortcut, QMainWindow, QCompleter, QInputDialog,
|
||||||
QWidget, QSizePolicy, QStatusBar, QToolTip, QDialog,
|
QWidget, QSizePolicy, QStatusBar, QToolTip, QDialog,
|
||||||
QMenu, QAction, QStackedWidget)
|
QMenu, QAction, QStackedWidget, QToolButton)
|
||||||
|
|
||||||
import electrum
|
import electrum
|
||||||
from electrum import (keystore, ecc, constants, util, bitcoin, commands,
|
from electrum import (keystore, ecc, constants, util, bitcoin, commands,
|
||||||
@@ -104,11 +104,14 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
LN_NUM_PAYMENT_ATTEMPTS = 10
|
LN_NUM_PAYMENT_ATTEMPTS = 10
|
||||||
|
|
||||||
class StatusBarButton(QPushButton):
|
class StatusBarButton(QToolButton):
|
||||||
def __init__(self, icon, tooltip, func):
|
def __init__(self, icon, tooltip, func):
|
||||||
QPushButton.__init__(self, icon, '')
|
QToolButton.__init__(self)
|
||||||
|
self.setText('')
|
||||||
|
self.setIcon(icon)
|
||||||
self.setToolTip(tooltip)
|
self.setToolTip(tooltip)
|
||||||
self.setFlat(True)
|
self.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
|
||||||
|
self.setAutoRaise(True)
|
||||||
self.setMaximumWidth(25)
|
self.setMaximumWidth(25)
|
||||||
self.clicked.connect(self.onPress)
|
self.clicked.connect(self.onPress)
|
||||||
self.func = func
|
self.func = func
|
||||||
@@ -2239,7 +2242,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
|
|||||||
self.lightning_button.setText('')
|
self.lightning_button.setText('')
|
||||||
self.lightning_button.setToolTip(_("The Lightning Network graph is fully synced."))
|
self.lightning_button.setToolTip(_("The Lightning Network graph is fully synced."))
|
||||||
else:
|
else:
|
||||||
self.lightning_button.setMaximumWidth(25 + 4 * char_width_in_lineedit())
|
self.lightning_button.setMaximumWidth(25 + 5 * char_width_in_lineedit())
|
||||||
self.lightning_button.setText(progress_str)
|
self.lightning_button.setText(progress_str)
|
||||||
self.lightning_button.setToolTip(_("The Lightning Network graph is syncing...\n"
|
self.lightning_button.setToolTip(_("The Lightning Network graph is syncing...\n"
|
||||||
"Payments are more likely to succeed with a more complete graph."))
|
"Payments are more likely to succeed with a more complete graph."))
|
||||||
|
|||||||
@@ -126,9 +126,10 @@ class HelpLabel(QLabel):
|
|||||||
return QLabel.leaveEvent(self, event)
|
return QLabel.leaveEvent(self, event)
|
||||||
|
|
||||||
|
|
||||||
class HelpButton(QPushButton):
|
class HelpButton(QToolButton):
|
||||||
def __init__(self, text):
|
def __init__(self, text):
|
||||||
QPushButton.__init__(self, '?')
|
QToolButton.__init__(self)
|
||||||
|
self.setText('?')
|
||||||
self.help_text = text
|
self.help_text = text
|
||||||
self.setFocusPolicy(Qt.NoFocus)
|
self.setFocusPolicy(Qt.NoFocus)
|
||||||
self.setFixedWidth(round(2.2 * char_width_in_lineedit()))
|
self.setFixedWidth(round(2.2 * char_width_in_lineedit()))
|
||||||
|
|||||||
Reference in New Issue
Block a user