working edit

This commit is contained in:
moerp 2021-05-29 18:26:07 +02:00
parent 4902551a9b
commit 565b9e27c5
2 changed files with 20 additions and 14 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.15.0, 2021-05-24T23:36:50. -->
<!-- Written by QtCreator 4.15.0, 2021-05-29T17:42:25. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@ -294,8 +294,9 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/matth/Documents/Workspace/MPI/SQM-GUI-ng/sources/SQM-GUI-ng.pro</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">C:/Users/matth/Documents/Workspace/MPI/SQM-GUI-ng/sources/SQM-GUI-ng.pro</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">SQM-GUI-ng2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/matth/Documents/Workspace/MPI/sqm-gui/sources/SQM-GUI-ng.pro</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">C:/Users/matth/Documents/Workspace/MPI/sqm-gui/sources/SQM-GUI-ng.pro</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>

View File

@ -17,17 +17,19 @@ int SQMTableModel::columnCount(const QModelIndex & /*parent*/) const {
QVariant SQMTableModel::data(const QModelIndex &index, int role) const {
try {
if (role == Qt::DisplayRole) {
int row = index.row();
int col = index.column();
return sqmMatrix.at(col).at(row);
if (role == Qt::DisplayRole) {
int row = index.row();
int col = index.column();
QString result;
try {
result = QString::number(sqmMatrix.at(col).at(row));
} catch (...) {
result = "x";
}
return result;
}
catch (...) {
return QVariant();
}
return QVariant();
}
QVariant SQMTableModel::headerData(int section, Qt::Orientation orientation, int role) const {
@ -58,7 +60,7 @@ bool SQMTableModel::setData(const QModelIndex &index, const QVariant &value, int
sqmMatrix.at(col).at(row) = value.toInt();
//UpdateSqmMatrix();
UpdateSqmMatrix(index);
return true;
}
return false;
@ -145,7 +147,10 @@ void SQMTableModel::UpdateSqmMatrix(QModelIndex startIndex) {
// Update sqmMatrix
for (int i = start_row; i < binLen; i++) {
sqmMatrix.at(1).at(i) = (sqmMatrix.at(2).at(i - 1) * sqmMatrix.at(2).at(i - 1)) % mod;
if (start_col != 1) {
sqmMatrix.at(1).at(i) = (sqmMatrix.at(2).at(i - 1) * sqmMatrix.at(2).at(i - 1)) % mod;
start_col = 0;
}
if (sqmMatrix.at(0).at(i) == 0) {
sqmMatrix.at(2).at(i) = sqmMatrix.at(1).at(i);