5

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?

BartoszKP
  • 34,786
  • 15
  • 102
  • 130
Linoliumz
  • 2,381
  • 3
  • 28
  • 35

2 Answers2

4

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.
BartoszKP
  • 34,786
  • 15
  • 102
  • 130
Greg S
  • 12,333
  • 2
  • 41
  • 48
  • Thanks a lot, I did not know Q3TextEdit existed, I will use it. – Linoliumz Jun 17 '10 at 09:01
  • 2
    @ user363778 - Instead of using Q3TextEdit, it's better if you use QTextEdit in the above way. From Qt documentation - **"We strongly advise against using it (Q3TextEdit) in new code."** – liaK Jun 17 '10 at 09:12
3

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.

BartoszKP
  • 34,786
  • 15
  • 102
  • 130
Jérôme
  • 26,567
  • 29
  • 98
  • 120