diff --git a/LunaTranslator/LunaTranslator/gui/textbrowser.py b/LunaTranslator/LunaTranslator/gui/textbrowser.py index f6fbdd0b..64bcfa70 100644 --- a/LunaTranslator/LunaTranslator/gui/textbrowser.py +++ b/LunaTranslator/LunaTranslator/gui/textbrowser.py @@ -393,12 +393,12 @@ class Textbrowser: index = linei _ = self.yinyinglabels[index] - if self.align:#不然有时候有一个微小的错位 - fm = QFontMetricsF(self.textbrowser.currentCharFormat().font()) - w = fm.width(block.text()[s : s + l]) - WW = self.textbrowser.width() - _.move(int(WW / 2 - w / 2), tl1.y()) + if self.align: + _.setAlignment(Qt.AlignCenter) + _.move(0,tl1.y()) + _.setFixedWidth(self.textbrowser.width()) else: + _.setAlignment(Qt.AlignLeft) _.move(tl1) _.setText(block.text()[s : s + l]) _.setFont(self.textbrowser.currentCharFormat().font())