0

I have a Monitoring program which runs another long process (can take days). The process generates huge amount of log information. This log information cant be stored in memory so I am redirecting it into log file. The problem is than Monitoring program need to display this log. I cant use a widget that requires storing entire text in memory. I need to have somting like

class TextView
{
    void setModel(TextModel*)
}

class TextModel
{
    int pageCount();
    QString page(int i);

Q_SIGNALS:
    void pageCountChanged(int cnt)
};

Implementation of TextModel will load page in memory per request.

Of courese I can implement Text Viewer widget from the scratch, but I have no enough time to do that. Any sugestions?

ArmanHunanyan
  • 905
  • 3
  • 11
  • 24

1 Answers1

1

You can use QListView and derive your model from QAbstractListModel. You need to define rowCount and data methods in your model.

Pavel Strakhov
  • 39,123
  • 5
  • 88
  • 127
  • Thanks for answer. Actually I have already considered this. A little problem here is that view requesting from model single line. Ideally it will be grate if view will request a page. Of course I will keep this as a backup solution. – ArmanHunanyan Jun 20 '13 at 14:31
  • You can read pages from file and cache them in the model. In `data()` you can return lines from already cached pages. Anyway, if your model is file-based, you need to implement some caching because views' caching is weak and views sometimes generate many `data()` calls. – Pavel Strakhov Jun 20 '13 at 14:38