summaryrefslogtreecommitdiffstats
path: root/qt-ui/modeldelegates.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-07-18 09:01:37 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-07-18 09:01:37 -0300
commit63c33e152eab201f46c91e98e3fd4799996ea495 (patch)
tree3833af7c26850b5092e419669f1e8ffa0d893f61 /qt-ui/modeldelegates.cpp
parent29b92e2fc544e3ebab863e48cd6fc66aa7c09b63 (diff)
downloadsubsurface-63c33e152eab201f46c91e98e3fd4799996ea495.tar.gz
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 <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/modeldelegates.cpp')
-rw-r--r--qt-ui/modeldelegates.cpp9
1 files changed, 9 insertions, 0 deletions
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;