Widget required
-
Hi All,
Just a simple query (I hope).
I've been searching for a textbox of some sort that I can display messages as the program runs.
These are information messages, the sort that might go in a log file.
C++ Builder has Memopad which is very useful but I can't find an equivalent in Qt.I guess I could use the texteditor widget but that seems to be overkill for what I want which is purely a display that I can add lines to when I want.
Any help appreciated.
BTW, I have searched on the forums and in the Qt documentation but can't find anything.
-
@Colins2 https://doc.qt.io/qt-5/qplaintextedit.html is lighter than QTextEdit
-
Hi
For big log files, maybe a ListView+model works better ?
QPlainTextEdit is much like MemoPad however, it will copy the text to its internal buffer so it becomes heavy with thousands of lines. -
Thanks for the suggestions.
I looked at both of these, although not in any great detail but they didn't seem to be what I was looking for.
Maybe the QPlainTextEdit will work, I don't anticipate thousands of lines.
Oh how easy MemoPad is: memo1->lines.add(string) :-)
I was surprised that there wasn't something similar in Qt. -
@Colins2 You can append text using https://doc.qt.io/qt-5/qplaintextedit.html#appendPlainText
-
well that is surely as easy a MemoPad :)
ui->logText->appendPlainText(string);
Note:
Disable the undo buffer
https://doc.qt.io/qt-5/qplaintextedit.html#undoRedoEnabled-prop
its default true and no reason to make copy of its structure when used for "logging"
(IMHO)