QTextEdit::setTextFormat(Qt::LogText) does not exist anymore, what else can I use to log?

≡放荡痞女 提交于 2019-12-10 14:22:27

问题


I need a text logger in my C++ application, QTextEdit used to have this feature until Qt 3.3 but unfortunately it has been removed. Is there an alternative that I could use?


回答1:


Two options:

  1. You could simply use QTextEdit::setReadOnly(true), the old Qt::LogText flag basically just put the QTextEdit in plain-text read-only mode.
  2. Or use Q3TextEdit, the Qt4 compatibility class for the old Qt3 QTextEdit.



回答2:


It seems to me that QPlainTextEdit is what you are looking for.

It is optimized for dealing with plain text data and can be can put it in read only.



来源:https://stackoverflow.com/questions/3060141/qtexteditsettextformatqtlogtext-does-not-exist-anymore-what-else-can-i-us

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!