Contiguous cache example: minor cleanup
Modernised contiguous cache example. Change-Id: I88d67b03ed95a61484873149da16f0d814b26cd8 Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
f1db0ca251
commit
15a7e108aa
@ -3,19 +3,15 @@
|
|||||||
#include "randomlistmodel.h"
|
#include "randomlistmodel.h"
|
||||||
#include <QRandomGenerator>
|
#include <QRandomGenerator>
|
||||||
|
|
||||||
static const int bufferSize(500);
|
static constexpr int bufferSize(500);
|
||||||
static const int lookAhead(100);
|
static constexpr int lookAhead(100);
|
||||||
static const int halfLookAhead(lookAhead/2);
|
static constexpr int halfLookAhead(lookAhead / 2);
|
||||||
|
|
||||||
RandomListModel::RandomListModel(QObject *parent)
|
RandomListModel::RandomListModel(QObject *parent)
|
||||||
: QAbstractListModel(parent), m_rows(bufferSize), m_count(10000)
|
: QAbstractListModel(parent), m_rows(bufferSize), m_count(10000)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
RandomListModel::~RandomListModel()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int RandomListModel::rowCount(const QModelIndex &) const
|
int RandomListModel::rowCount(const QModelIndex &) const
|
||||||
{
|
{
|
||||||
return m_count;
|
return m_count;
|
||||||
|
@ -13,7 +13,6 @@ class RandomListModel : public QAbstractListModel
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
RandomListModel(QObject *parent = nullptr);
|
RandomListModel(QObject *parent = nullptr);
|
||||||
~RandomListModel();
|
|
||||||
|
|
||||||
int rowCount(const QModelIndex & = QModelIndex()) const override;
|
int rowCount(const QModelIndex & = QModelIndex()) const override;
|
||||||
QVariant data(const QModelIndex &, int) const override;
|
QVariant data(const QModelIndex &, int) const override;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user