# HG changeset patch # User Michiel Broek # Date 1675349415 -3600 # Node ID ebf7ef31da35da3bc7651fe0bc3e461165c7143f # Parent eb0a5f132ea931a47adcd7ed3a26eafe6aeaac4c Set yeastpack dropdown on yeast edit row start. diff -r eb0a5f132ea9 -r ebf7ef31da35 src/EditProductTab6.cpp --- a/src/EditProductTab6.cpp Thu Feb 02 15:23:18 2023 +0100 +++ b/src/EditProductTab6.cpp Thu Feb 02 15:50:15 2023 +0100 @@ -1364,19 +1364,22 @@ yeast_instock_changed(true); yeast_load_packages(product->yeasts.at(product->yeasts_row).laboratory, product->yeasts.at(product->yeasts_row).form); - int index = -1; + /* + * Try to set the yeastpack dropdown to the selected entry if set. + */ + int index = 0; if (! product->yeasts.at(product->yeasts_row).yp_uuid.isNull() && (product->yeasts.at(product->yeasts_row).yp_uuid.length() == 36)) { query.prepare("SELECT * FROM inventory_yeastpack WHERE laboratory=:laboratory AND form=:form AND valid='1' ORDER BY laboratory,package"); query.bindValue(":laboratory", product->yeasts.at(product->yeasts_row).laboratory); query.bindValue(":form", product->yeasts.at(product->yeasts_row).form); - qDebug() << " search" << product->yeasts.at(product->yeasts_row).laboratory << product->yeasts.at(product->yeasts_row).form; query.exec(); while (query.next()) { index++; - if (query.value("uuid").toString() == product->yeasts.at(product->yeasts_row).yp_uuid) + if (query.value("uuid").toString() == product->yeasts.at(product->yeasts_row).yp_uuid) { + this->ypackageEdit->setCurrentIndex(index); break; + } } - qDebug() << " result" << index << (query.value("uuid").toString() == product->yeasts.at(product->yeasts_row).yp_uuid); } connect(yselectEdit, QOverload::of(&QComboBox::currentIndexChanged), this, &EditProduct::yeast_select_changed);