<div dir="ltr"><div dir="ltr">On Fri, Jan 26, 2024 at 1:20 PM Charles <<a href="mailto:peacech@gmail.com">peacech@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:arial,helvetica,sans-serif;font-size:small">You probably should also use `charFormat` from the cursor not from the `textEditor()`.<br></div><div style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div style="font-family:arial,helvetica,sans-serif;font-size:small">fmt.setFontWeight(QFont.Weight.Bold if c.charFormat().fontWeight() != QFont.Weight.Bold else QFont.Weight.Normal)</div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div></div></div></div></blockquote></div></blockquote><div><br></div><div>I rewrote it as this:</div><div><br></div>    def setBoldText(self):<br>        fmt = QTextCharFormat()<br>        cursor = self.textEditor.textCursor()<br>        fmt.setFontWeight(QFont.Weight.Bold if cursor.charFormat().fontWeight() != QFont.Weight.Bold else QFont.Weight.Normal)<br><div>        cursor.setCharFormat(fmt)</div><div><br></div><div>However, the bug remains. Thanks, though!</div><div><br></div><div>Best,</div><div>Ovid </div></div></div>