Set the Cylinder/Weigth even if it's the same old value.

Since the cylinders and weigths have other data attached
to it, like size and working pressure, one could mess the
other data and want it to revert to the cylinder / weigth
defaults, but for that the user had to choose another
item, then go back to the previous one, so the cache would
be clean.

This patch fixes that by reverting the values to the
it fixes linus bug n2, where he had invalid data
on the other fields and had to go back and forth for it
to be fixed.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-09-26 10:26:58 -03:00
parent e6be14bf10
commit fd7a671a1d

View file

@ -185,11 +185,6 @@ void TankInfoDelegate::setModelData(QWidget* editor, QAbstractItemModel* model,
int tankSize = tanks->data(tanks->index(row, TankInfoModel::ML)).toInt();
int tankPressure = tanks->data(tanks->index(row, TankInfoModel::BAR)).toInt();
// don't fuck the other data, jimmy.
if ( mymodel->data(thisindex, CylindersModel::TYPE).toString() == currCombo.activeText){
return;
}
mymodel->setData(IDX(CylindersModel::TYPE), currCombo.activeText, Qt::EditRole);
mymodel->passInData(IDX(CylindersModel::WORKINGPRESS), tankPressure);
mymodel->passInData(IDX(CylindersModel::SIZE), tankSize);
@ -253,10 +248,6 @@ void WSInfoDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, co
int grams = wsim->data(wsim->index(row, WSInfoModel::GR)).toInt();
QVariant v = QString(currCombo.activeText);
// don't set if it's the same as it was before setting.
if (mymodel->data(thisindex, WeightModel::TYPE).toString() == currCombo.activeText){
return;
}
mymodel->setData(IDX(WeightModel::TYPE), v, Qt::EditRole);
mymodel->passInData(IDX(WeightModel::WEIGHT), grams);
}