From QPlainTextEdit's documentation:
QPlainTextEdit
is an advanced viewer/editor supporting plain text. It
is optimized to handle large documents and to respond quickly to user
input.
QPlainText uses very much the same technology and concepts as
QTextEdit
, but is optimized for plain text handling.
QPlainTextEdit
works on paragraphs and characters. A paragraph is a
formatted string which is word-wrapped to fit into the width of the
widget. By default when reading plain text, one newline signifies a
paragraph. A document consists of zero or more paragraphs. Paragraphs
are separated by hard line breaks. Each character within a paragraph
has its own attributes, for example, font and color.
QPlainTextEdit
is a thin class, implemented by using most of the
technology that is behind QTextEdit
and QTextDocument
. Its performance
benefits over QTextEdit
stem mostly from using a different and
simplified text layout called QPlainTextDocumentLayout
on the text
document (see QTextDocument::setDocumentLayout()
). The plain text
document layout does not support tables nor embedded frames, and
replaces a pixel-exact height calculation with a line-by-line
respectively paragraph-by-paragraph scrolling approach. This makes it
possible to handle significantly larger documents, and still resize
the editor with line wrap enabled in real time. It also makes for a
fast log viewer (see setMaximumBlockCount()
).
So the difference is that QPlainTextEdit
is optimized for handling plain text, and can be used even with very large plain text files. Also the way text is formatted is simpler.
If you plan to support only plain texts, then QPlainTextEdit
is the right choice.
QPlainTextEdit
? – Ascogonium