src/EditRecipe.cpp

changeset 120
0ab611547a57
parent 119
68853aee2ef9
child 121
2f9711ce5ad4
--- a/src/EditRecipe.cpp	Fri Apr 08 19:44:14 2022 +0200
+++ b/src/EditRecipe.cpp	Fri Apr 08 20:03:56 2022 +0200
@@ -705,6 +705,30 @@
 
     if (recipe->fermentables.size() < 1) {
 	qDebug() << "  no fermentables, return.";
+	recipe->est_og = 0.980;
+    	ui->est_ogEdit->setValue(0.980);
+    	ui->est_og2Edit->setValue(0.980);
+    	ui->est_og3Edit->setValue(0.980);
+    	ui->est_ogShow->setValue(0.980);
+    	recipe->est_color = 0;
+    	ui->est_colorEdit->setValue(0);
+    	ui->est_colorEdit->setStyleSheet(Utils::ebc_to_style(0));
+    	ui->est_color2Edit->setValue(0);
+    	ui->est_color2Edit->setStyleSheet(Utils::ebc_to_style(0));
+    	ui->est_colorShow->setValue(0);
+	ui->perc_mashShow->setValue(0);
+	ui->perc_sugarsShow->setValue(0);
+	ui->perc_caraShow->setValue(0);
+	ui->lintnerShow->setValue(0);
+    	recipe->est_fg = 0.980;
+    	ui->est_fgEdit->setValue(0.980);
+    	ui->est_fg3Edit->setValue(0.980);
+    	ui->est_fgShow->setValue(0.980);
+    	ui->est_abvEdit->setValue(0);
+    	ui->est_abv2Edit->setValue(0);
+    	ui->est_abvShow->setValue(0);
+    	recipe->est_abv = 0;
+    	ui->calEdit->setValue(0);
 	return;
     }
     qDebug() << "  adjust to 100" << recipe->fermentables_use100;
@@ -1342,6 +1366,9 @@
     int row = pb->objectName().toInt();
     qDebug() << "Delete fermentable row" << row << recipe->fermentables.size();
 
+    if (recipe->fermentables.size() < 1)
+	return;
+
     int rc = QMessageBox::warning(this, tr("Delete fermentable"), tr("Delete %1").arg(recipe->fermentables.at(row).f_name),
 		    QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
     if (rc == QMessageBox::No)

mercurial