Quote Originally Posted by JordyD View Post
I also have a class that inherits from QSyntaxHighlighter, and it only accepts QTextDocuments to highlight.
Might be, but in your function you create a local document and set it and then forget about it. And there is no need to do so. Really, better use setPlainText(). This also creates/alters the existing document. For your other class you can still use document().

EDIT: but if you really want use this, instead of creating a new one, just use the old one!