Qt的最好的方式来显示非常大的富文本? [英] Qt's best way to display very large rich text?
问题描述
我需要显示非常大的日志,使用HTML标记来标记不同类型的数据。
I need to display very large logs that uses HTML tags for marking different types of data.
使用QTextEdit和QTextBrowser真的会减慢应用程序,尤其是追加操作。我真的很想保持QTextEdit的界面和能力。
Using QTextEdit and QTextBrowser really slows the application, especially on append operations. I would really like to keep the QTextEdit interface and abilities.
我见过的人实现了自己的风格的TextEdit来提高性能,但我漫游,如果有人解决了问题使用Qt工具。我想到了使用Model / View框架根据需要加载数据,但是它不是我想要的东西。
I've seen people that implemented their own flavor of TextEdit to improve performance, but I wandered if anyone solved this issue using "Qt" tools. I thought about using the Model/View framework to load data on demand but it is not quite what it was intended for I think.
也许子类化QTextEdit并覆盖它的一些
Maybe subclassing QTextEdit and override some of its slots for scrolling...
如果有人遇到这个问题并解决了问题,我将非常感激。
If anyone encountered this issue and solved it, I would appreciate some tips.
>感谢。
推荐答案
由于你的日志大概是在某个级别的表格,所以Model / View框架听起来像是可以工作您。也许你可以尝试使用 QListView
和 QGraphicsTextItem
:
Since your log is presumably tabular at some level, then the Model/View framework sounds like it could work for you. Perhaps you could try using a QListView
with QGraphicsTextItem
:
http://doc.qt.nokia.com/latest/qgraphicstextitem.html
它有设置/获取HTML的方法:
It has methods for setting/getting the HTML:
http://doc.qt.nokia.com/latest/qgraphicstextitem.html#setHtml
http://doc.qt.nokia .com / latest / qgraphicstextitem.html#toHtml
你会得到一些好处和麻烦从这样写。但你一定能够巧妙的插入和附加速度。
You'll get some benefits and hassles from writing it that way. But you should certainly be able to finesse the insertions and append speed.
这篇关于Qt的最好的方式来显示非常大的富文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!