From 63c33e152eab201f46c91e98e3fd4799996ea495 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 18 Jul 2013 09:01:37 -0300 Subject: Don't set if equal, on edit cylinders and weigth types. Don't set the cylinders and weight types if they are the same than before, this fixes a bad thing that happened when playing with the values. it could blank out the values carefully chosen by you. Signed-off-by: Tomaz Canabrava --- qt-ui/modeldelegates.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp index 97a00a461..58a7e141b 100644 --- a/qt-ui/modeldelegates.cpp +++ b/qt-ui/modeldelegates.cpp @@ -150,6 +150,10 @@ 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(model->index(currCombo.currRow, CylindersModel::TYPE), currCombo.activeText, Qt::EditRole); mymodel->passInData(model->index(currCombo.currRow, CylindersModel::WORKINGPRESS), tankPressure); mymodel->passInData(model->index(currCombo.currRow, CylindersModel::SIZE), tankSize); @@ -175,6 +179,11 @@ 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(model->index(currCombo.currRow, WeightModel::TYPE), v, Qt::EditRole); mymodel->passInData(model->index(currCombo.currRow, WeightModel::WEIGHT), grams); qDebug() << "Fixme, every weigth is 0.0 grams. see:" << grams; -- cgit v1.2.3-70-g09d2