Obey justify option also in viewer

This commit is contained in:
Veronica K. B. Olsen
2019-06-08 23:10:11 +02:00
parent 11bdf03f7c
commit 94da52982d
+10 -3
View File
@@ -13,7 +13,9 @@
import logging
import nw
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QTextBrowser
from PyQt5.QtGui import QTextOption
logger = logging.getLogger(__name__)
@@ -29,17 +31,22 @@ class GuiDocViewer(QTextBrowser):
self.theParent = theParent
self.theTheme = theParent.theTheme
self.theDoc = self.document()
self.theDoc.setDefaultStyleSheet((
self.theQDoc = self.document()
self.theQDoc.setDefaultStyleSheet((
"h1, h2, h3, h4 {{"
" color: rgb({0},{1},{2});"
"}}"
).format(
*self.theTheme.colHead
))
self.theDoc.setDocumentMargin(self.mainConf.textMargin[0])
self.theQDoc.setDocumentMargin(self.mainConf.textMargin[0])
self.setMinimumWidth(300)
theOpt = QTextOption()
if self.mainConf.doJustify:
theOpt.setAlignment(Qt.AlignJustify)
self.theQDoc.setDefaultTextOption(theOpt)
logger.debug("DocViewer initialisation complete")
return