From f7bd793d93c29a848a141d7421f648dd7885d0af Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sat, 21 Nov 2020 13:30:26 +0100 Subject: [PATCH] Fix scaling of QSwitch on high DPI --- nw/gui/custom.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/nw/gui/custom.py b/nw/gui/custom.py index f2deb452..2c655c57 100644 --- a/nw/gui/custom.py +++ b/nw/gui/custom.py @@ -218,11 +218,19 @@ class QHelpLabel(QLabel): class QSwitch(QAbstractButton): - def __init__(self, parent=None, width=40, height=20): + def __init__(self, parent=None, width=None, height=None): super().__init__(parent=parent) - self._xW = int(nw.CONFIG.guiScale*width) - self._xH = int(nw.CONFIG.guiScale*height) + if width is None: + self._xW = nw.CONFIG.pxInt(40) + else: + self._xW = width + + if height is None: + self._xH = nw.CONFIG.pxInt(20) + else: + self._xH = height + self._xR = int(self._xH*0.5) self._xT = int(self._xH*0.6) self._rB = int(nw.CONFIG.guiScale*2)