Use QUndoStack with QPlainTextEdit. Tricky workaround, but works.