-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdegreesmodel.h
More file actions
33 lines (25 loc) · 956 Bytes
/
degreesmodel.h
File metadata and controls
33 lines (25 loc) · 956 Bytes
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
#pragma once
#include "types.h"
#include <QAbstractListModel>
class DegreesModel final : public QAbstractTableModel, public Clipboard {
Q_OBJECT
Degrees data_;
int precision_{3};
signals:
void dataChanged_(const Degrees&);
public:
explicit DegreesModel(QObject* parent = nullptr);
// QAbstractItemModel interface
int rowCount(const QModelIndex& = {}) const override;
int columnCount(const QModelIndex& = {}) const override;
QVariant data(const QModelIndex& index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
Qt::ItemFlags flags(const QModelIndex& index) const override;
void setCoeffData(const Degrees& data);
void setPrecision(int prec);
void load(const QString& fileName);
void save(const QString& fileName) const;
// Clipboard interface
QString copy() const override;
void paste(QString&&) override;
};