Obey justify option also in viewer
This commit is contained in:
+10
-3
@@ -13,7 +13,9 @@
|
|||||||
import logging
|
import logging
|
||||||
import nw
|
import nw
|
||||||
|
|
||||||
|
from PyQt5.QtCore import Qt
|
||||||
from PyQt5.QtWidgets import QTextBrowser
|
from PyQt5.QtWidgets import QTextBrowser
|
||||||
|
from PyQt5.QtGui import QTextOption
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -29,17 +31,22 @@ class GuiDocViewer(QTextBrowser):
|
|||||||
self.theParent = theParent
|
self.theParent = theParent
|
||||||
self.theTheme = theParent.theTheme
|
self.theTheme = theParent.theTheme
|
||||||
|
|
||||||
self.theDoc = self.document()
|
self.theQDoc = self.document()
|
||||||
self.theDoc.setDefaultStyleSheet((
|
self.theQDoc.setDefaultStyleSheet((
|
||||||
"h1, h2, h3, h4 {{"
|
"h1, h2, h3, h4 {{"
|
||||||
" color: rgb({0},{1},{2});"
|
" color: rgb({0},{1},{2});"
|
||||||
"}}"
|
"}}"
|
||||||
).format(
|
).format(
|
||||||
*self.theTheme.colHead
|
*self.theTheme.colHead
|
||||||
))
|
))
|
||||||
self.theDoc.setDocumentMargin(self.mainConf.textMargin[0])
|
self.theQDoc.setDocumentMargin(self.mainConf.textMargin[0])
|
||||||
self.setMinimumWidth(300)
|
self.setMinimumWidth(300)
|
||||||
|
|
||||||
|
theOpt = QTextOption()
|
||||||
|
if self.mainConf.doJustify:
|
||||||
|
theOpt.setAlignment(Qt.AlignJustify)
|
||||||
|
self.theQDoc.setDefaultTextOption(theOpt)
|
||||||
|
|
||||||
logger.debug("DocViewer initialisation complete")
|
logger.debug("DocViewer initialisation complete")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user