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.

  • On the vast majority of monitors, the update is 60 times per second, i.e. about 16ms per frame. Meaning to update more often, if it is impossible to see? - Vladimir Gamalyan
  • @VladimirGamalian I may have a little wrong formulated the task. I want to find a suitable widget for displaying lines (packages) as quickly and easily as possible. It will be used in the terminal of the serial port, which sends / receives data at intervals up to 5ms quite adequately, but with the conclusion of the problem. - ArTTo
  • 3
    You need to use the view instead of the widget. The view will query only the data that is visible on the screen at that moment. There is nothing complicated in my model, I have to define several methods of my own, such as returning the number of data, the actual data on the index, and I don’t remember anything else. At least you can start, if you stop, put the code here, you can figure it out. - Vladimir Gamalyan
  • 3
    Something is wrong with you. QPlainTextEdit great for logging. The row limit is easily adjustable by QPlainTextEdit::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. - alexis031182
  • one
    @ArTTo, there is a QPlainTextEdit::setCurrentCharFormat(const QTextCharFormat&) method QPlainTextEdit::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

0