久久久久久久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 ()?環形?)
主站蜘蛛池模板: 国产精品久久久久久福利一牛影视 | 精品国产欧美日韩不卡在线观看 | 国产高清视频一区 | 国产乱码精品一区二区三区五月婷 | 久久久亚洲成人 | 永久免费在线观看 | 成年人在线观看视频 | 亚洲永久 | 狠狠爱视频 | 中文字幕国产 | www.久久久.com| 羞羞视频在线免费 | 中文字幕精品一区 | 国产精品久久久久久久久免费 | 亚洲成人一区二区 | 精品福利在线 | 天天射网站 | 亚洲va中文字幕 | 国产精品久久精品 | 91精品国产乱码久久蜜臀 | 狠狠干天天干 | 亚洲成网 | 欧美一级黄色片 | 99亚洲| 91国自产 | 一区二区三区在线观看视频 | 在线视频一区二区 | 欧美成人精品一区二区三区 | 国产欧美性成人精品午夜 | 国产成人福利在线观看 | 国产精品污污视频 | 一区二区三区四区免费在线观看 | 久久综合成人精品亚洲另类欧美 | 国产成人在线一区 | 国产三级在线观看播放 | 在线欧美小视频 | 中文字幕一区在线观看视频 | 91素人| 国产伦精品一区二区三区精品视频 | 日本成人午夜影院 | 黑人精品欧美一区二区蜜桃 |