Hello, you need to display very quickly (every 1-10 milliseconds) lines on the screen. At first I used QPlainTextEdit for this, but he didn’t really fit this task. The number of displayed lines is fixed (1000) and it is difficult to delete the first lines with it. Now I use QListWidget, but it is very slow for such a task. I thought to make my own model for QListView, based on a cyclic buffer, but when outputting to the widget, I still have to deal with deleting / inserting elements (i.e., driving a lot of memory). Who can faced such task, advise option of implementation.
QPlainTextEdit
great for logging. The row limit is easily adjustable byQPlainTextEdit::setMaximumBlockCount(int)
. As soon as the number of lines reaches the limit, the first lines will be deleted automatically. However, it is better not to use models for frequently updated logs at all, since they are updated rather slowly due to the use of signals and slots. - alexis031182QPlainTextEdit::setCurrentCharFormat(const QTextCharFormat&)
methodQPlainTextEdit::setCurrentCharFormat(const QTextCharFormat&)
. Use it before inserting a new line. This is the easiest way. You can also insert text so-called. in blocks. There will already be more flexible formatting available. - alexis031182