diff --git a/sources/mainwindow.ui b/sources/mainwindow.ui
index e44f1a5..f8045b0 100644
--- a/sources/mainwindow.ui
+++ b/sources/mainwindow.ui
@@ -52,7 +52,11 @@
-
-
+
+
+ 1
+
+
diff --git a/sources/sqmtablemodel.cpp b/sources/sqmtablemodel.cpp
index 30c9c1c..aaa0a67 100644
--- a/sources/sqmtablemodel.cpp
+++ b/sources/sqmtablemodel.cpp
@@ -8,7 +8,7 @@ SQMTableModel::SQMTableModel(QObject *parent)
int SQMTableModel::rowCount(const QModelIndex & /*parent*/) const {
- return 2;
+ return binLen;
}
int SQMTableModel::columnCount(const QModelIndex & /*parent*/) const {
@@ -103,10 +103,14 @@ void SQMTableModel::CalculateSqmMatrix() {
// Init BIN Column
vector colBin;
- for (int i = 0; i <= binLen; i++) {
+ for (int i = 0; i < binLen; i++) {
colBin.push_back(bin[i] - '0');
}
+
+ // Add or remove rows
+ beginResetModel();
sqmMatrix.push_back(colBin);
+ endResetModel();
// Init SQN & MUL Column
vector colSqn, colMul;
@@ -117,7 +121,7 @@ void SQMTableModel::CalculateSqmMatrix() {
// Calculate SQM
- for (int i = 0; i <= binLen; i++) {
+ for (int i = 1; i < binLen; i++) {
sqmMatrix.at(1).push_back((sqmMatrix.at(2).at(i - 1) * sqmMatrix.at(2).at(i - 1)) % mod);
if (sqmMatrix.at(0).at(i) == 0) {
diff --git a/sources/sqmtablemodel.h b/sources/sqmtablemodel.h
index 55488a2..7a9dc83 100644
--- a/sources/sqmtablemodel.h
+++ b/sources/sqmtablemodel.h
@@ -26,7 +26,7 @@ private:
int base;
int exp;
int mod;
- int binLen;
+ int binLen = 0;
vector> sqmMatrix;
};