blob: dcbe890f549bafe2f04b0a2654e36b558e35e114 (
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
27
28
29
30
31
32
33
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef MODEL_H
#define MODEL_H
#include <QAbstractListModel>
#include <QObject>
#include <qlist.h>
class LinearModel : public QAbstractListModel
{
Q_OBJECT
public:
LinearModel(QObject *parent = 0)
: QAbstractListModel(parent) {}
int rowCount(const QModelIndex &parent = QModelIndex()) const;
QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
bool setData(const QModelIndex &index, const QVariant &value,
int role = Qt::EditRole);
bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex());
bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex());
private:
QList<int> values;
};
#endif
|