如何在QT中的QTextBrowser中追加文本?
我创建了一个 QTextBrowser 来显示大量数据(实际上显示运行时日志),这些数据是在另一个进程中动态生成的。
我发现我可以使用 fopen("log.html","a")
将数据附加到实际日志文件中,然后每次都 reload()
它已更新,但我认为这效率不高,甚至可能不明智。
我想知道是否有一种巧妙的方法来实现这一点。
I have created a QTextBrowser
to display a large amount of data (actually displaying the run time log), which is dynamically generated in another processes.
I have found out that I can use fopen("log.html","a")
to append data to an actually log file, and reload()
it every time it's updated, but I think that's not efficient, or even possibly unwise.
I wonder if there's a neat way to implement this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
QTextBrowser
继承QTextEdit
,因此您可以使用QTextEdit::append
:QTextBrowser
inheritsQTextEdit
, so you can useQTextEdit::append
:写到一半,补充 TonyK 的答案:
也许是 append 方法是您要找的吗?
Got half way through writing this, supplemental to TonyK's answer:
Perhaps the append Method is what you're looking for?