From 0b065ea76b199a8bb00ef10746fd1180b3129e5e Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sat, 21 Nov 2020 13:16:50 +0100 Subject: [PATCH] Fixed high DPI issue in QConfigLayout class --- nw/gui/custom.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/nw/gui/custom.py b/nw/gui/custom.py index a6260f33..f2deb452 100644 --- a/nw/gui/custom.py +++ b/nw/gui/custom.py @@ -59,8 +59,9 @@ class QConfigLayout(QGridLayout): self._itemMap = {} - self.setHorizontalSpacing(8) - self.setVerticalSpacing(8) + wSp = nw.CONFIG.pxInt(8) + self.setHorizontalSpacing(wSp) + self.setVerticalSpacing(wSp) return @@ -107,11 +108,12 @@ class QConfigLayout(QGridLayout): qLabel = None raise ValueError("theLabel must be a QLabel") - qLabel.setContentsMargins(0, 4, 0, 4) + hM = nw.CONFIG.pxInt(4) + qLabel.setContentsMargins(0, hM, 0, hM) self.addWidget(qLabel, self._nextRow, 0, 1, 2, Qt.AlignLeft) self.setRowStretch(self._nextRow, 0) - self.setRowStretch(self._nextRow+1, 1) + self.setRowStretch(self._nextRow + 1, 1) self._nextRow += 1 @@ -140,10 +142,11 @@ class QConfigLayout(QGridLayout): qWidget = None raise ValueError("theWidget must be a QWidget") - qLabel.setIndent(8) + wSp = nw.CONFIG.pxInt(8) + qLabel.setIndent(wSp) if helpText is not None: qHelp = QHelpLabel(str(helpText), self._helpCol, self._fontScale) - qHelp.setIndent(8) + qHelp.setIndent(wSp) labelBox = QVBoxLayout() labelBox.addWidget(qLabel) @@ -160,13 +163,13 @@ class QConfigLayout(QGridLayout): controlBox = QHBoxLayout() controlBox.addWidget(qWidget, 0, Qt.AlignVCenter) controlBox.addWidget(QLabel(theUnit), 0, Qt.AlignVCenter) - controlBox.setSpacing(8) + controlBox.setSpacing(wSp) self.addLayout(controlBox, self._nextRow, 1, 1, 1, Qt.AlignRight | Qt.AlignVCenter) elif theButton is not None: controlBox = QHBoxLayout() controlBox.addWidget(qWidget, 0, Qt.AlignVCenter) controlBox.addWidget(theButton, 0, Qt.AlignVCenter) - controlBox.setSpacing(8) + controlBox.setSpacing(wSp) self.addLayout(controlBox, self._nextRow, 1, 1, 1, Qt.AlignRight | Qt.AlignVCenter) else: self.addWidget(qWidget, self._nextRow, 1, 1, 1, Qt.AlignRight | Qt.AlignVCenter)