sqm-gui/sources/sqmtablemodel.h

36 lines
1.1 KiB
C
Raw Normal View History

2021-05-22 22:43:44 +02:00
#ifndef SQMTABLEMODEL_H
#define SQMTABLEMODEL_H
#include <QAbstractTableModel>
#include <vector>
using namespace std;
class SQMTableModel : public QAbstractTableModel {
Q_OBJECT
public:
SQMTableModel(QObject *parent = nullptr);
2021-05-24 23:25:17 +02:00
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
2021-05-22 22:43:44 +02:00
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
2021-05-28 16:49:53 +02:00
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
2021-05-28 17:18:56 +02:00
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
2021-05-22 22:43:44 +02:00
void SetStartValues(int pBase, int pExp, int pMod);
private:
std::string IntToBinary(int n);
2021-05-28 19:32:05 +02:00
void CalculateSqmMatrix();
void UpdateSqmMatrix(QModelIndex startIndex);
2021-05-22 22:43:44 +02:00
int base;
int exp;
int mod;
2021-05-28 20:20:04 +02:00
int binLen = 0;
2021-05-29 18:54:54 +02:00
QModelIndex changedHere;
2021-05-22 22:43:44 +02:00
vector<vector <int>> sqmMatrix;
};
#endif // SQMTABLEMODEL_H