From 399b13dd3dd3021ea878fdd5cdaba04275a3c9ca Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Wed, 17 Jun 2020 22:27:06 +0200 Subject: [PATCH] Make both panes use viewportmargin --- nw/gui/doceditor.py | 1 - nw/gui/docviewer.py | 17 +++++------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index 5e0fb025..efe863a7 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -351,7 +351,6 @@ class GuiDocEditor(QTextEdit): else: rH = 0 - # print(tM, tH, rH, max(tM, tH, rH)) self.setViewportMargins(tM, max(cM, tH, rH), tM, cM) return diff --git a/nw/gui/docviewer.py b/nw/gui/docviewer.py index 8c2ea236..b280aa01 100644 --- a/nw/gui/docviewer.py +++ b/nw/gui/docviewer.py @@ -60,6 +60,7 @@ class GuiDocViewer(QTextBrowser): self.qDocument = self.document() self.setMinimumWidth(self.mainConf.pxInt(300)) + self.setAutoFillBackground(True) self.setOpenExternalLinks(False) self.initViewer() @@ -104,11 +105,12 @@ class GuiDocViewer(QTextBrowser): self.setFont(theFont) docPalette = self.palette() + docPalette.setColor(QPalette.Window, QColor(*self.theTheme.colBack)) docPalette.setColor(QPalette.Base, QColor(*self.theTheme.colBack)) docPalette.setColor(QPalette.Text, QColor(*self.theTheme.colText)) self.setPalette(docPalette) - self.qDocument.setDocumentMargin(self.mainConf.getTextMargin()) + self.qDocument.setDocumentMargin(0) theOpt = QTextOption() if self.mainConf.doJustify: theOpt.setAlignment(Qt.AlignJustify) @@ -242,19 +244,10 @@ class GuiDocViewer(QTextBrowser): tH = self.docHeader.height() fH = self.docFooter.height() fY = self.height() - fH - tB - tT = cM - tH - bT = cM - fH + self.docHeader.setGeometry(tB, tB, tW, tH) self.docFooter.setGeometry(tB, fY, tW, fH) - self.setViewportMargins(0, tH, 0, fH) - - docFormat = self.qDocument.rootFrame().frameFormat() - docFormat.setTopMargin(max(0, tT)) - docFormat.setBottomMargin(max(0, bT)) - - self.qDocument.blockSignals(True) - self.qDocument.rootFrame().setFrameFormat(docFormat) - self.qDocument.blockSignals(False) + self.setViewportMargins(cM, max(cM, tH), cM, max(cM, fH)) return