From da08cd19e8721f65946daf6517c4ddb8f35b24a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Tue, 30 Jul 2024 21:17:38 +0800 Subject: [PATCH] Update textbrowser.py --- LunaTranslator/LunaTranslator/rendertext/textbrowser.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/LunaTranslator/LunaTranslator/rendertext/textbrowser.py b/LunaTranslator/LunaTranslator/rendertext/textbrowser.py index 6da0e88a..b231fdfd 100644 --- a/LunaTranslator/LunaTranslator/rendertext/textbrowser.py +++ b/LunaTranslator/LunaTranslator/rendertext/textbrowser.py @@ -263,6 +263,7 @@ class TextBrowser(QWidget, dataget): return Qt.AlignmentFlag.AlignCenter if atcenter else Qt.AlignmentFlag.AlignLeft def _textbrowser_append(self, origin, atcenter, text, tag, color, cleared): + self.textbrowser.document().blockSignals(True) font = self._createqfont(origin) self._setnextfont(font, cleared) self.textbrowser.setAlignment(self._getqalignment(atcenter)) @@ -272,6 +273,8 @@ class TextBrowser(QWidget, dataget): self.textbrowser.insertPlainText(_space + text) blockcount_after = self.textbrowser.document().blockCount() self._setlineheight(blockcount, blockcount_after, origin, len(tag) > 0) + self.textbrowser.document().blockSignals(False) + self.textbrowser.document().contentsChanged.emit() if len(tag) > 0: self._addtag(tag) self._showyinyingtext(blockcount, blockcount_after, color, font)