pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

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 ()?環形?)
主站蜘蛛池模板: 防勒索软件_数据防泄密_Trellix(原McAfee)核心代理商_Trellix(原Fireeye)售后-广州文智信息科技有限公司 | 烟气在线监测系统_烟气在线监测仪_扬尘检测仪_空气质量监测站「山东风途物联网」 | 螺旋绞龙叶片,螺旋输送机厂家,山东螺旋输送机-淄博长江机械制造有限公司 | 安徽集装箱厂-合肥国彩钢结构板房工程有限公司 | 电动百叶窗,开窗器,电动遮阳百叶,电动开窗机生产厂家-徐州鑫友工控科技发展有限公司 | 粒米特测控技术(上海)有限公司-测功机_减速机测试台_电机测试台 | 防潮防水通风密闭门源头实力厂家 - 北京酷思帝克门窗 | 河南档案架,档案密集架,手动密集架,河南密集架批发/报价 | 体视显微镜_荧光生物显微镜_显微镜报价-微仪光电生命科学显微镜有限公司 | T恤衫定做,企业文化衫制作订做,广告T恤POLO衫定制厂家[源头工厂]-【汉诚T恤定制网】 | 宁夏活性炭_防护活性炭_催化剂载体炭-宁夏恒辉活性炭有限公司 | 合肥升降机-合肥升降货梯-安徽升降平台「厂家直销」-安徽鼎升自动化科技有限公司 | 玉米深加工设备-玉米深加工机械-新型玉米工机械生产厂家-河南粮院机械制造有限公司 | 广州/东莞小字符喷码机-热转印打码机-喷码机厂家-广州瑞润科技 | 湿地保护| 山东钢格板|栅格板生产厂家供应商-日照森亿钢格板有限公司 | 分光色差仪,测色仪,反透射灯箱,爱色丽分光光度仪,美能达色差仪维修_苏州欣美和仪器有限公司 | 深圳彩钢板_彩钢瓦_岩棉板_夹芯板_防火复合彩钢板_长鑫 | POS机办理_个人POS机免费领取 - 银联POS机申请首页 | 美缝剂_美缝剂厂家_美缝剂加盟-地老板高端瓷砖美缝剂 | 万烁建筑设计院-建筑设计公司加盟,设计院加盟分公司,市政设计加盟 | 找果网 | 苹果手机找回方法,苹果iPhone手机丢了找回,认准找果网! | 在线悬浮物浓度计-多参数水质在线检测仪-上海沃懋仪表科技有限公司 | 培训中心-翰香原香酥板栗饼加盟店总部-正宗板栗酥饼技术 | 复合肥,化肥厂,复合肥批发,化肥代理,复合肥品牌-红四方 | 电脑知识|软件|系统|数据库|服务器|编程开发|网络运营|知识问答|技术教程文章 - 好吧啦网 | 深圳美安可自动化设备有限公司,喷码机,定制喷码机,二维码喷码机,深圳喷码机,纸箱喷码机,东莞喷码机 UV喷码机,日期喷码机,鸡蛋喷码机,管芯喷码机,管内壁喷码机,喷码机厂家 | 岸电电源-60HZ变频电源-大功率变频电源-济南诚雅电子科技有限公司 | 档案密集架,移动密集架,手摇式密集架,吉林档案密集架-厂家直销★价格公道★质量保证 | 三氯异氰尿酸-二氯-三氯-二氯异氰尿酸钠-优氯净-强氯精-消毒片-济南中北_优氯净厂家 | 厂房出租_厂房出售_产业园区招商_工业地产 - 中工招商网 | 小型铜米机-干式铜米机-杂线全自动铜米机-河南鑫世昌机械制造有限公司 | 北京开业庆典策划-年会活动策划公司-舞龙舞狮团大鼓表演-北京盛乾龙狮鼓乐礼仪庆典策划公司 | 滚筒线,链板线,总装线,流水线-上海体能机电有限公司 | 四合院设计_四合院装修_四合院会所设计-四合院古建设计与建造中心1 | 办公室家具公司_办公家具品牌厂家_森拉堡办公家具【官网】 | 清洁设备_洗地机/扫地机厂家_全自动洗地机_橙犀清洁设备官网 | 托盘租赁_塑料托盘租赁_托盘出租_栈板出租_青岛托盘租赁-优胜必达 | 炭黑吸油计_测试仪,单颗粒子硬度仪_ASTM标准炭黑自销-上海贺纳斯仪器仪表有限公司(HITEC中国办事处) | 办公室装修_上海办公室设计装修_时尚办公新主张-后街印象 | 英超直播_英超免费在线高清直播_英超视频在线观看无插件-24直播网 |