Thank you for that Caduel.

Using the document's isModified() function genuinely reflects the correct state and ignores any highlighting in the QTextEdit. For the moment, I just test that function in on_textEdit_textChanged and all is well.

I will rewrite it to use QTextDocument::contentsChanged() eventually; it's clearly the correct thing to do.

Thank you for an excellent solution.