diff options
Diffstat (limited to 'qt-ui/models.cpp')
-rw-r--r-- | qt-ui/models.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index 76ad6e1e5..b8909dadf 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -543,20 +543,16 @@ void WeightModel::setDive(dive* d) { if (current) clear(); - - int amount = MAX_WEIGHTSYSTEMS; + rows = 0; for(int i = 0; i < MAX_WEIGHTSYSTEMS; i++) { - weightsystem_t *weightsystem = &d->weightsystem[i]; - if (weightsystem_none(weightsystem)) { - amount = i; - break; + if (!weightsystem_none(&d->weightsystem[i])) { + rows = i+1; } } - rows = amount; current = d; changed = false; - if (amount > 0) { - beginInsertRows(QModelIndex(), 0, amount - 1); + if (rows > 0) { + beginInsertRows(QModelIndex(), 0, rows-1); endInsertRows(); } } |