summaryrefslogtreecommitdiffstats
path: root/examples/tools/offsetvector/randomlistmodel.h
diff options
context:
space:
mode:
Diffstat (limited to 'examples/tools/offsetvector/randomlistmodel.h')
-rw-r--r--examples/tools/offsetvector/randomlistmodel.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/examples/tools/offsetvector/randomlistmodel.h b/examples/tools/offsetvector/randomlistmodel.h
new file mode 100644
index 0000000..e102255
--- /dev/null
+++ b/examples/tools/offsetvector/randomlistmodel.h
@@ -0,0 +1,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