Skip to content

Commit

Permalink
Fixed warning if you enter 0 for counts it just sets a default -11 in…
Browse files Browse the repository at this point in the history
… log 10. Fixed At as metaloid
  • Loading branch information
Arthur Glowacki committed Aug 22, 2024
1 parent d2073d1 commit 55149bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/mvc/FitElementsTableModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ bool FitElementsTableModel::setData(const QModelIndex &index,
{
bool ok = false;
double dval = value.toDouble(&ok);
QVariant new_value = value;
if (false == ok)
{
QMessageBox::warning(nullptr, "Could not convert to double", "Could not convert your value to a double.");
Expand All @@ -566,8 +567,7 @@ bool FitElementsTableModel::setData(const QModelIndex &index,
}
else if (dval < -10)
{
QMessageBox::warning(nullptr, "Value too small", "Value is too small and will create NaN/Inf. Use range -10 : 20 .");
return false;
new_value = QVariant(-11);
}
}
else
Expand All @@ -579,11 +579,10 @@ bool FitElementsTableModel::setData(const QModelIndex &index,
}
else if (dval < 1.0e-10)
{
QMessageBox::warning(nullptr, "Value too small", "Value is too small and will create NaN/Inf. Use range 1.0e-10 : 1.0e20 .");
return false;
new_value = QVariant(0);
}
}
node->itemData[1] = value;
node->itemData[1] = new_value;
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/mvc/PeriodicTableWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public slots:
{"Pb", Element_Class::Post_Transition_Metals},
{"Bi", Element_Class::Post_Transition_Metals},
{"Po", Element_Class::Post_Transition_Metals},
{"At", Element_Class::Post_Transition_Metals},
{"At", Element_Class::Metalloids},
{"Rn", Element_Class::Noble_gases},
{"Fr", Element_Class::Alkaline_Metal},
{"Ra", Element_Class::Alkaline_Earth_Metal},
Expand Down

0 comments on commit 55149bd

Please sign in to comment.