久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

QTextEdit 與 QPlainTextEdit

QTextEdit vs QPlainTextEdit(QTextEdit 與 QPlainTextEdit)
本文介紹了QTextEdit 與 QPlainTextEdit的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

QTextEditQPlainTextEdit 有什么區別,為什么要使用一個?

What's the difference between QTextEdit and QPlainTextEdit, why use one over the other?

我正在編寫一個文本編輯器作為學習 Qt5 的練習,現在我想知道是使用 QTextEdit 還是 QPlainTextEdit.到目前為止,我只發現您可以在 QTextEdit 中顯示圖像,但除此之外,它們對我來說看起來有些相同.我的文本編輯器應該支持一些基本的語法高亮顯示(可能使用 textChanged() 信號),但就需求而言就差不多了.

I'm coding a text editor as an exercice to learn Qt5, and now I'm wondering whether to use QTextEdit or QPlainTextEdit. So far I've only found out that you can display images in QTextEdit, but other than that they look somewhat identical to me. My text editor should support some basic syntax highlighting (probably using textChanged() signal), but that's pretty much as far as the requirements go.

Google 搜索QTextEdit vs QPlainTextEdit"QTextEdit 與 QPlainTextEdit 相比" 沒有給我任何可以比較這兩個類的不錯的結果.

Google searches for "QTextEdit vs QPlainTextEdit" and "QTextEdit compared to QPlainTextEdit" didn't give me any decent results that would compare the two classes.

推薦答案

來自 Qt 的文檔:

QPlainTextEdit 是一個支持純文本的高級查看器/編輯器.它經過優化以處理大型文檔并快速響應用戶輸入.

QPlainTextEdit is an advanced viewer/editor supporting plain text. It is optimized to handle large documents and to respond quickly to user input.

QPlainText 使用的技術和概念與QTextEdit,但針對純文本處理進行了優化.

QPlainText uses very much the same technology and concepts as QTextEdit, but is optimized for plain text handling.

QPlainTextEdit 適用于段落和字符.一個段落是一個被自動換行以適應寬度的格式化字符串小部件.默認情況下,在閱讀純文本時,換行符表示段落.一個文檔由零個或多個段落組成.段落由硬換行符分隔.段落中的每個字符有自己的屬性,例如字體和顏色.

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.

后來:

與 QTextEdit 的區別

QPlainTextEdit 是一個瘦類,使用大部分QTextEditQTextDocument 背后的技術.它的性能優于 QTextEdit 的好處主要來自于使用不同的和在文本上稱為 QPlainTextDocumentLayout 的簡化文本布局文檔(見 QTextDocument::setDocumentLayout()).純文本文檔布局不支持表格或嵌入式框架,并且用逐行替換像素精確高度計算分別是逐段滾動的方法.這使它可以處理明顯更大的文檔,并且仍然可以調整大小實時啟用換行的編輯器.這也使得一個快速日志查看器(請參閱 setMaximumBlockCount()).

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()).

所以區別在于 QPlainTextEdit 針對處理純文本進行了優化,甚至可以用于處理非常大的純文本文件.文本的格式化方式也更簡單.

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.

如果您打算只支持純文本,那么 QPlainTextEdit 是正確的選擇.

If you plan to support only plain texts, then QPlainTextEdit is the right choice.

這篇關于QTextEdit 與 QPlainTextEdit的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How can I read and manipulate CSV file data in C++?(如何在 C++ 中讀取和操作 CSV 文件數據?)
In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,為什么我不能像這樣編寫 for() 循環: for( int i = 1, double i2 = 0;)
How does OpenMP handle nested loops?(OpenMP 如何處理嵌套循環?)
Reusing thread in loop c++(在循環 C++ 中重用線程)
Precise thread sleep needed. Max 1ms error(需要精確的線程睡眠.最大 1ms 誤差)
Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?環形?)
主站蜘蛛池模板: 伊人网伊人网 | 天天插天天操 | 久久久精品视频免费 | 国产精品精品3d动漫 | 一区二区三区在线免费观看 | 国产91精品久久久久久久网曝门 | 欧美久久久电影 | 国产欧美精品 | 亚洲国产精品一区二区久久 | 久久99这里只有精品 | 亚洲精品久久久一区二区三区 | 久久久久无码国产精品一区 | 欧美日韩亚 | 黄片毛片在线观看 | 日韩免费av一区二区 | 在线观看视频中文字幕 | 国产精品久久久久久久一区探花 | 国产精品视频久久久 | 国产高清在线精品一区二区三区 | www.天天操.com | 九九热这里| 九九激情视频 | 久久国产精品无码网站 | 精品视频一区二区 | 99精品国产一区二区三区 | 中文字幕中文字幕 | 久久精彩视频 | 欧美日产国产成人免费图片 | 91免费在线视频 | 日日操av | 国产探花在线精品一区二区 | 欧美5区 | 欧美三区在线观看 | 久久久久国产 | 成人免费观看网站 | 久草视频在线播放 | 日韩欧美在线观看一区 | 日韩欧美不卡 | 性一交一乱一伦视频免费观看 | 国产精品久久久久久婷婷天堂 | 亚洲精品久久久9婷婷中文字幕 |