-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtablemodel.h
More file actions
48 lines (35 loc) · 1.42 KB
/
tablemodel.h
File metadata and controls
48 lines (35 loc) · 1.42 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef TABLEMODEL_H
#define TABLEMODEL_H
#pragma once
//#include <QAbstractTableModel>
#include <QModelIndex>
//#include <QString>
//#include <QVariant>
//#include <QVector>
//#include <QStringList>
//#include <QHash>
//#include <QByteArray>
class TableModel : public QAbstractTableModel {
Q_OBJECT
public:
explicit TableModel(QObject* parent = nullptr);
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count,
const QModelIndex &destinationParent, int destinationChild) override;
bool removeRows(int position, int rows, const QModelIndex& parent = QModelIndex()) override;
void addSegment(double timeMinutes, int startConc, int endConc, int insertRow);
void removeSegment(int pos = -1);
QVector<QVector<double>> getSegments() const;
void clearSegments();
void updateSegments();
signals:
void segmentsChanged();
private:
QList<QString> columnHeaders;
QList<QList<QString>> tableData;
};
#endif // TABLEMODEL_H