mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 06:15:26 +00:00
desktop: don't save data to the "no-name" tank
There seems to be no point to saving data to the tank with the empty name. Don't save tank-pressure and size to that tank info. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
d16a9f118a
commit
a55c7ff079
1 changed files with 4 additions and 2 deletions
|
@ -217,9 +217,11 @@ void TankInfoDelegate::setModelData(QWidget *, QAbstractItemModel *, const QMode
|
||||||
{
|
{
|
||||||
QAbstractItemModel *mymodel = currCombo.model;
|
QAbstractItemModel *mymodel = currCombo.model;
|
||||||
TankInfoModel *tanks = TankInfoModel::instance();
|
TankInfoModel *tanks = TankInfoModel::instance();
|
||||||
QModelIndexList matches = tanks->match(tanks->index(0, 0), Qt::DisplayRole, currCombo.activeText, 1, Qt::MatchFixedString | Qt::MatchWrap);
|
QString cylinderName = currCombo.activeText.trimmed();
|
||||||
|
if (cylinderName.isEmpty())
|
||||||
|
return;
|
||||||
|
QModelIndexList matches = tanks->match(tanks->index(0, 0), Qt::DisplayRole, cylinderName, 1, Qt::MatchFixedString | Qt::MatchWrap);
|
||||||
int row;
|
int row;
|
||||||
QString cylinderName = currCombo.activeText;
|
|
||||||
if (matches.isEmpty()) {
|
if (matches.isEmpty()) {
|
||||||
tanks->insertRows(tanks->rowCount(), 1);
|
tanks->insertRows(tanks->rowCount(), 1);
|
||||||
tanks->setData(tanks->index(tanks->rowCount() - 1, 0), currCombo.activeText);
|
tanks->setData(tanks->index(tanks->rowCount() - 1, 0), currCombo.activeText);
|
||||||
|
|
Loading…
Add table
Reference in a new issue