summaryrefslogtreecommitdiffstats
path: root/examples/tools/contiguouscache/randomlistmodel.h
blob: ad8cfad3842bf5fc5344f8dda598c1d11b5f32a5 (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 <QContiguousCache>
#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 QContiguousCache<QString> m_rows;
    const int m_count;
};

#endif