summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/weightmodel.cpp7
1 files changed, 6 insertions, 1 deletions
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));
}