src/EditProduct.cpp

changeset 198
904591820c3d
parent 196
f7954f2d4451
child 202
49ec4fdee5a6
--- a/src/EditProduct.cpp	Thu May 05 20:43:45 2022 +0200
+++ b/src/EditProduct.cpp	Sat May 07 13:55:36 2022 +0200
@@ -331,7 +331,10 @@
 	product->starter_type = query.value("starter_type").toInt();
 	product->starter_sg = query.value("starter_sg").toDouble();
 	product->starter_viability = query.value("starter_viability").toInt();
-	product->yeast_prod_date = query.value("yeast_prod_date").toDate();
+	if (query.value("yeast_prod_date").toString().length() == 10)
+	    product->yeast_prod_date = query.value("yeast_prod_date").toDate();
+	else
+	    product->yeast_prod_date = QDate();
 	product->yeast_pitchrate = query.value("yeast_pitchrate").toDouble();
 	product->prop_type[0] = query.value("prop1_type").toInt();
 	product->prop_volume[0] = query.value("prop1_volume").toDouble();
@@ -1046,6 +1049,9 @@
     connect(ui->addYeast, SIGNAL(clicked()), this, SLOT(addYeastRow_clicked()));
     connect(ui->stmethodEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditProduct::yeast_method_changed);
     connect(ui->startersgEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditProduct::yeast_starter_sg_changed);
+    connect(ui->productionButton1, SIGNAL(clicked()), this, SLOT(yeast_prod_date_today()));
+    connect(ui->productionButton2, SIGNAL(clicked()), this, SLOT(yeast_prod_date_clear()));
+    connect(ui->productionEdit, &QDateEdit::dateChanged, this, &EditProduct::yeast_prod_date_changed);
 
     // All signals from tab "Mash"
     ui->mashsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);

mercurial