mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 16:44:13 +08:00
Update textbrowser.py
This commit is contained in:
parent
85d6aa0ba3
commit
da08cd19e8
@ -263,6 +263,7 @@ class TextBrowser(QWidget, dataget):
|
|||||||
return Qt.AlignmentFlag.AlignCenter if atcenter else Qt.AlignmentFlag.AlignLeft
|
return Qt.AlignmentFlag.AlignCenter if atcenter else Qt.AlignmentFlag.AlignLeft
|
||||||
|
|
||||||
def _textbrowser_append(self, origin, atcenter, text, tag, color, cleared):
|
def _textbrowser_append(self, origin, atcenter, text, tag, color, cleared):
|
||||||
|
self.textbrowser.document().blockSignals(True)
|
||||||
font = self._createqfont(origin)
|
font = self._createqfont(origin)
|
||||||
self._setnextfont(font, cleared)
|
self._setnextfont(font, cleared)
|
||||||
self.textbrowser.setAlignment(self._getqalignment(atcenter))
|
self.textbrowser.setAlignment(self._getqalignment(atcenter))
|
||||||
@ -272,6 +273,8 @@ class TextBrowser(QWidget, dataget):
|
|||||||
self.textbrowser.insertPlainText(_space + text)
|
self.textbrowser.insertPlainText(_space + text)
|
||||||
blockcount_after = self.textbrowser.document().blockCount()
|
blockcount_after = self.textbrowser.document().blockCount()
|
||||||
self._setlineheight(blockcount, blockcount_after, origin, len(tag) > 0)
|
self._setlineheight(blockcount, blockcount_after, origin, len(tag) > 0)
|
||||||
|
self.textbrowser.document().blockSignals(False)
|
||||||
|
self.textbrowser.document().contentsChanged.emit()
|
||||||
if len(tag) > 0:
|
if len(tag) > 0:
|
||||||
self._addtag(tag)
|
self._addtag(tag)
|
||||||
self._showyinyingtext(blockcount, blockcount_after, color, font)
|
self._showyinyingtext(blockcount, blockcount_after, color, font)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user