In Qt 6.9 and propbably earlier versions you can force the textedit to accept only plain text.
self.textEdit.setAcceptRichText(False)