Clean up warnings and deprecations in extensions and formats

This commit is contained in:
Veronica Berglyd Olsen
2025-01-13 00:38:50 +01:00
parent ca2943775d
commit a60e0b3c87
6 changed files with 67 additions and 82 deletions
+6 -3
View File
@@ -278,8 +278,10 @@ class ToQTextDocument(Tokenizer):
printer.setPageMargins(self._pageMargins, QPageLayout.Unit.Millimeter)
printer.setOutputFileName(str(path))
self._document.documentLayout().setPaintDevice(printer)
self._document.setPageSize(printer.pageRect(QPrinter.Unit.Millimeter).size())
if layout := self._document.documentLayout():
layout.setPaintDevice(printer)
self._document.setPageSize(printer.pageRect(QPrinter.Unit.DevicePixel).size())
self._document.print(printer)
return
@@ -458,7 +460,8 @@ class ToQTextDocument(Tokenizer):
cursor.insertFrame(fFmt)
cursor.setBlockFormat(bFmt)
cursor.insertText(self._project.localLookup("New Page"), cFmt)
cursor.swap(self._document.rootFrame().lastCursorPosition())
if root := self._document.rootFrame():
cursor.swap(root.lastCursorPosition())
return