mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-28 07:51:27 +00:00
qt dark style: fix padding of PayToEdit
based on Electron-Cash/Electron-Cash@7e69f0e6ea see ColinDuquesnoy/QDarkStyleSheet#159
This commit is contained in:
parent
201909df51
commit
00b2fee461
2 changed files with 21 additions and 0 deletions
|
@ -56,6 +56,7 @@ from .installwizard import InstallWizard, WalletAlreadyOpenInMemory
|
||||||
from .util import get_default_language, read_QIcon, ColorScheme
|
from .util import get_default_language, read_QIcon, ColorScheme
|
||||||
from .main_window import ElectrumWindow
|
from .main_window import ElectrumWindow
|
||||||
from .network_dialog import NetworkDialog
|
from .network_dialog import NetworkDialog
|
||||||
|
from .stylesheet_patcher import patch_qt_stylesheet
|
||||||
|
|
||||||
|
|
||||||
class OpenFileEventFilter(QObject):
|
class OpenFileEventFilter(QObject):
|
||||||
|
@ -132,6 +133,8 @@ class ElectrumGui(Logger):
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
use_dark_theme = False
|
use_dark_theme = False
|
||||||
self.logger.warning(f'Error setting dark theme: {repr(e)}')
|
self.logger.warning(f'Error setting dark theme: {repr(e)}')
|
||||||
|
# Apply any necessary stylesheet patches
|
||||||
|
patch_qt_stylesheet(use_dark_theme=use_dark_theme)
|
||||||
# Even if we ourselves don't set the dark theme,
|
# Even if we ourselves don't set the dark theme,
|
||||||
# the OS/window manager/etc might set *a dark theme*.
|
# the OS/window manager/etc might set *a dark theme*.
|
||||||
# Hence, try to choose colors accordingly:
|
# Hence, try to choose colors accordingly:
|
||||||
|
|
18
electrum/gui/qt/stylesheet_patcher.py
Normal file
18
electrum/gui/qt/stylesheet_patcher.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
"""This is used to patch the QApplication style sheet.
|
||||||
|
It reads the current stylesheet, appends our modifications and sets the new stylesheet.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from PyQt5 import QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
def patch_qt_stylesheet(use_dark_theme: bool) -> None:
|
||||||
|
if not use_dark_theme:
|
||||||
|
return
|
||||||
|
|
||||||
|
app = QtWidgets.QApplication.instance()
|
||||||
|
|
||||||
|
style_sheet = app.styleSheet()
|
||||||
|
style_sheet = style_sheet + '''
|
||||||
|
QAbstractScrollArea { padding: 0px; }
|
||||||
|
'''
|
||||||
|
app.setStyleSheet(style_sheet)
|
Loading…
Add table
Reference in a new issue