Add font init to viewer, and update manuscript tool preview

This commit is contained in:
Veronica Berglyd Olsen
2024-05-20 11:36:30 +02:00
parent 09b51badd4
commit cb19475409
3 changed files with 35 additions and 28 deletions
+10 -5
View File
@@ -31,7 +31,7 @@ from time import time
from typing import TYPE_CHECKING
from PyQt5.QtCore import Qt, QTimer, QUrl, pyqtSignal, pyqtSlot
from PyQt5.QtGui import QCloseEvent, QColor, QCursor, QFont, QPalette, QResizeEvent
from PyQt5.QtGui import QCloseEvent, QColor, QCursor, QPalette, QResizeEvent
from PyQt5.QtPrintSupport import QPrinter, QPrintPreviewDialog
from PyQt5.QtWidgets import (
QAbstractItemView, QApplication, QDialog, QFormLayout, QGridLayout,
@@ -831,12 +831,17 @@ class _PreviewWidget(QTextBrowser):
return
def setTextFont(self, family: str, size: int) -> None:
"""Set the text font properties."""
if family:
font = QFont()
"""Set the text font properties and then reset for sub-widgets.
This needs special attention since there appears to be a bug in
Qt 5.15.3. See issues #1862 and #1875.
"""
if family and size > 4:
font = self.font()
font.setFamily(family)
font.setPointSize(size)
self.document().setDefaultFont(font)
self.setFont(font)
self.ageLabel.setFont(SHARED.theme.guiFont)
self.buildProgress.setFont(SHARED.theme.guiFont)
return
##