mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									29b92e2fc5
								
							
						
					
					
						commit
						63c33e152e
					
				
					 1 changed files with 9 additions and 0 deletions
				
			
		|  | @ -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; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue