summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/modeldelegates.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-12-11 22:56:26 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-12-13 11:49:59 -0800
commit11e576ffbf6ddc117d13fd8b02722948efd9ce54 (patch)
treea87e3fddb36aed79e966652cb92f42ca7372eb57 /desktop-widgets/modeldelegates.cpp
parenta55c7ff0793c119e8472cecebfe8c059f55e74f8 (diff)
downloadsubsurface-11e576ffbf6ddc117d13fd8b02722948efd9ce54.tar.gz
core: remove the "no-name" tank info
There was a tank info with an empty name. According to a comment, this is needed for the "no cylinder" case. However, we now support empty cylinder tables, so this is not needed anymore. Therefore, remove it. Make sure that the user can still enter the empty name, just in case. But don't save the size and pressure in that case. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/modeldelegates.cpp')
-rw-r--r--desktop-widgets/modeldelegates.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/desktop-widgets/modeldelegates.cpp b/desktop-widgets/modeldelegates.cpp
index 11d42c36e..acfbfde52 100644
--- a/desktop-widgets/modeldelegates.cpp
+++ b/desktop-widgets/modeldelegates.cpp
@@ -218,8 +218,10 @@ void TankInfoDelegate::setModelData(QWidget *, QAbstractItemModel *, const QMode
QAbstractItemModel *mymodel = currCombo.model;
TankInfoModel *tanks = TankInfoModel::instance();
QString cylinderName = currCombo.activeText.trimmed();
- if (cylinderName.isEmpty())
+ if (cylinderName.isEmpty()) {
+ mymodel->setData(IDX(CylindersModel::TYPE), cylinderName, CylindersModel::TEMP_ROLE);
return;
+ }
QModelIndexList matches = tanks->match(tanks->index(0, 0), Qt::DisplayRole, cylinderName, 1, Qt::MatchFixedString | Qt::MatchWrap);
int row;
if (matches.isEmpty()) {