ArmanHunanyan
ArmanHunanyan

Reputation: 1015

QT Model/View like Log Viewer

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?

Upvotes: 0

Views: 1522

Answers (1)

Pavel Strakhov
Pavel Strakhov

Reputation: 40512

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

Upvotes: 1

Related Questions