From dd3c8dfac831c55259827b317bcf8954bfd241a3 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Wed, 1 May 2024 19:22:22 +0200 Subject: [PATCH] Use GUI font for the header and footer in the editor and viewer (#1842) --- novelwriter/gui/doceditor.py | 8 ++++---- novelwriter/gui/docviewer.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/novelwriter/gui/doceditor.py b/novelwriter/gui/doceditor.py index 08a963e70..29e83a0bd 100644 --- a/novelwriter/gui/doceditor.py +++ b/novelwriter/gui/doceditor.py @@ -39,8 +39,8 @@ from typing import TYPE_CHECKING from PyQt5.QtCore import ( - pyqtSignal, pyqtSlot, QObject, QPoint, QRegExp, QRegularExpression, - QRunnable, Qt, QTimer + QObject, QPoint, QRegExp, QRegularExpression, QRunnable, Qt, QTimer, + pyqtSignal, pyqtSlot ) from PyQt5.QtGui import ( QColor, QCursor, QFont, QKeyEvent, QKeySequence, QMouseEvent, QPalette, @@ -65,7 +65,7 @@ from novelwriter.tools.lipsum import GuiLipsum from novelwriter.types import ( QtAlignCenterTop, QtAlignJustify, QtAlignLeft, QtAlignLeftTop, - QtAlignRight, QtKeepAnchor, QtModCtrl, QtMouseLeft, QtModeNone, QtModShift, + QtAlignRight, QtKeepAnchor, QtModCtrl, QtModeNone, QtModShift, QtMouseLeft, QtMoveAnchor, QtMoveLeft, QtMoveRight ) @@ -334,7 +334,7 @@ def initEditor(self) -> None: font = QFont() font.setFamily(CONFIG.textFont) font.setPointSize(CONFIG.textSize) - self.setFont(font) + self._qDocument.setDefaultFont(font) # Set default text margins # Due to cursor visibility, a part of the margin must be diff --git a/novelwriter/gui/docviewer.py b/novelwriter/gui/docviewer.py index bc5caeb50..f5fbec428 100644 --- a/novelwriter/gui/docviewer.py +++ b/novelwriter/gui/docviewer.py @@ -30,7 +30,7 @@ from enum import Enum -from PyQt5.QtCore import pyqtSignal, pyqtSlot, QPoint, Qt, QUrl +from PyQt5.QtCore import QPoint, Qt, QUrl, pyqtSignal, pyqtSlot from PyQt5.QtGui import ( QCursor, QFont, QMouseEvent, QPalette, QResizeEvent, QTextCursor, QTextOption @@ -44,7 +44,7 @@ from novelwriter.common import cssCol from novelwriter.constants import nwHeaders, nwUnicode from novelwriter.core.tohtml import ToHtml -from novelwriter.enum import nwItemType, nwDocAction, nwDocMode +from novelwriter.enum import nwDocAction, nwDocMode, nwItemType from novelwriter.error import logException from novelwriter.extensions.eventfilters import WheelEventFilter from novelwriter.extensions.modified import NIconToolButton @@ -146,7 +146,7 @@ def initViewer(self) -> None: font = QFont() font.setFamily(CONFIG.textFont) font.setPointSize(CONFIG.textSize) - self.setFont(font) + self.document().setDefaultFont(font) # Set the widget colours to match syntax theme mainPalette = self.palette()