Small bug

This commit is contained in:
Olivier Keshavjee 2015-06-25 13:57:41 +02:00
parent ef1ba855e7
commit ed0bfed8dc
2 changed files with 6 additions and 4 deletions

View file

@ -29,7 +29,9 @@ class basicHighlighter(QSyntaxHighlighter):
"""Apply syntax highlighting to the given block of text.
"""
QTextCursor(self.currentBlock()).setBlockFormat(self._defaultBlockFormat)
bf = QTextBlockFormat(self._defaultBlockFormat)
bf.setAlignment(QTextCursor(self.currentBlock()).blockFormat().alignment())
QTextCursor(self.currentBlock()).setBlockFormat(bf)
#self.setFormat(0, len(text), self._defaultCharFormat)
# Spell checking

View file

@ -456,15 +456,15 @@ class textEditView(QTextEdit):
cursor = self.textCursor()
bf = cursor.blockFormat()
#bf = cursor.blockFormat()
bf = QTextBlockFormat()
bf.setAlignment(
Qt.AlignLeft if _format == "Left" else
Qt.AlignHCenter if _format == "Center" else
Qt.AlignRight if _format == "Right" else
Qt.AlignJustify)
print(bf.alignment() == Qt.AlignLeft)
cursor.mergeBlockFormat(bf)
cursor.setBlockFormat(bf)
self.setTextCursor(cursor)
elif self._textFormat == "t2t":