Qt Console: Fix font reset when moving between screens

When the console was moved between screen boundaries with different scaling
settings, the font was reset. This is because QPlainTextEdit sets the
documents default font back to its own font property when Qt has a font
change event. This patch sets the font property of the editor instead of
the document.

this ports https://github.com/Electron-Cash/Electron-Cash/commit/60d63b3272ed80a207d0bc2c304f5faf3e8a4c50

related: https://github.com/Electron-Cash/Electron-Cash/issues/1314
This commit is contained in:
Axel Gembe
2022-08-10 16:18:32 +02:00
committed by SomberNight
parent b5d2b3c512
commit 07ee204c9c
+1 -1
View File
@@ -58,7 +58,7 @@ class Console(QtWidgets.QPlainTextEdit):
self.setGeometry(50, 75, 600, 400)
self.setWordWrapMode(QtGui.QTextOption.WrapAnywhere)
self.setUndoRedoEnabled(False)
self.document().setDefaultFont(QtGui.QFont(MONOSPACE_FONT, 10, QtGui.QFont.Normal))
self.setFont(QtGui.QFont(MONOSPACE_FONT, 10, QtGui.QFont.Normal))
self.newPrompt("") # make sure there is always a prompt, even before first server.banner
self.updateNamespace({'run':self.run_script})