Previous patch failed with GUI conversion

This commit is contained in:
Grégory Soutadé 2012-05-29 19:37:00 +02:00
parent a987c09d5d
commit a65ee9c24f
2 changed files with 2 additions and 2 deletions

View File

@ -32,7 +32,7 @@ void FloatDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
QLineEdit *line = qobject_cast<QLineEdit *>(editor);
QString s ;
bool ok;
double value = line->text().replace(".", "").toInt(&ok);
double value = line->text().toDouble(&ok);
if (ok)
model->setData(index, qVariantFromValue(s.sprintf("%.2lf", value)));
}

View File

@ -69,7 +69,7 @@ void FormulaDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
}
else
{
res = value.replace(".", "").toInt(&ok);
res = value.toDouble(&ok);
if (ok)
model->setData(index, qVariantFromValue(s.sprintf("%.2lf", res)));
}