Hızlı yanıt: kod örneği
stackoverflow.com qtextedit-vs-qplaintextedit
From QPlainTextEdit's documentation: 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
, but is optimized for plain text handling. 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. is a thin class, implemented by using most of the
technology that is behind and . Its performance
benefits over stem mostly from using a different and
simplified text layout called on the text
document (see ). 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 ).So the difference is that 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 is the right choice.
- Introduction and Concepts:
QPlainTextEdit
QTextEdit
QPlainTextEdit
- Differences to QTextEdit:
QPlainTextEdit
QTextEdit
QTextDocument
QTextEdit
QPlainTextDocumentLayout
QTextDocument::setDocumentLayout()
setMaximumBlockCount()
QPlainTextEdit
QPlainTextEdit