summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--qt-models/weightmodel.cpp7
2 files changed, 7 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e8881c821..d539a28eb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,4 @@
+desktop: don't overwrite already set weights when changing weight type [#2938]
desktop: do substring search for equipment types
planner: properly initialize salinity
desktop: add an "Edit Gas Change" right-click option [#2910]
diff --git a/qt-models/weightmodel.cpp b/qt-models/weightmodel.cpp
index 6b5f9e70d..020e14c24 100644
--- a/qt-models/weightmodel.cpp
+++ b/qt-models/weightmodel.cpp
@@ -86,11 +86,16 @@ void WeightModel::setTempWS(int row, weightsystem_t ws)
// It is really hard to get the editor-close-hints and setModelData calls under
// control. Therefore, if the row is set to the already existing entry, don't
// enter temporary mode.
- if (same_string(d->weightsystems.weightsystems[row].description, ws.description)) {
+ const weightsystem_t &oldWS = d->weightsystems.weightsystems[row];
+ if (same_string(oldWS.description, ws.description)) {
free_weightsystem(ws);
} else {
tempRow = row;
tempWS = ws;
+
+ // If the user had already set a weight, don't overwrite that
+ if (oldWS.weight.grams)
+ tempWS.weight = oldWS.weight;
}
dataChanged(index(row, TYPE), index(row, WEIGHT));
}