Skip to content

Commit

Permalink
Refs #9371 Strip whitespace in Refl Gui table.
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry Jeffery committed Sep 4, 2014
1 parent 9596480 commit ebd419e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Code/Mantid/MantidQt/CustomInterfaces/src/QReflTableModel.cpp
Expand Up @@ -154,18 +154,21 @@ namespace MantidQt
*/
bool QReflTableModel::setData ( const QModelIndex & index, const QVariant & value, int role)
{
//Users may mistakenly enter whitespace. Let's strip it for them.
QString str = value.toString().trimmed();

if (index.isValid() && role == Qt::EditRole)
{
const int colNumber = index.column();
const int rowNumber = index.row();

if (colNumber == COL_GROUP)
{
m_tWS->Int(rowNumber, COL_GROUP) = value.toInt();
m_tWS->Int(rowNumber, COL_GROUP) = str.toInt();
}
else
{
m_tWS->String(rowNumber, colNumber) = value.toString().toStdString();
m_tWS->String(rowNumber, colNumber) = str.toStdString();
}

invalidateDataCache(rowNumber);
Expand Down

0 comments on commit ebd419e

Please sign in to comment.