summaryrefslogtreecommitdiffstats
path: root/examples/tools/offsetvector/randomlistmodel.h
blob: e102255cbb62870d3d1120320fd0ef2c72f99ae5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef RANDOMLISTMODEL_H
#define RANDOMLISTMODEL_H

#include <QOffsetVector>
#include <QAbstractListModel>

class QTimer;
class RandomListModel : public QAbstractListModel
{
    Q_OBJECT
public:
    RandomListModel(QObject *parent = 0);
    ~RandomListModel();

    int rowCount(const QModelIndex & = QModelIndex()) const;
    QVariant data(const QModelIndex &, int) const;

private:
    void cacheRows(int, int) const;
    QString fetchRow(int) const;

    mutable QOffsetVector<QString> m_rows;
    const int m_count;
};

#endif