divetripmodel: remove setData() function

The setData() function was used to edit the number of a dive.
However, that doesn't appear to be functional. Therefore, remove
the code. There is a context-menu entry "renumber dives" for that.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-03-09 16:31:24 +01:00 committed by Dirk Hohndel
parent 219420bd6e
commit 6e59ee00d8
2 changed files with 0 additions and 31 deletions

View file

@ -508,36 +508,6 @@ Qt::ItemFlags DiveTripModelBase::flags(const QModelIndex &index) const
return d && index.column() == NR ? base | Qt::ItemIsEditable : base;
}
bool DiveTripModelBase::setData(const QModelIndex &index, const QVariant &value, int role)
{
// We only support setting of data for dives and there, only the number.
dive *d = diveOrNull(index);
if (!d)
return false;
if (role != Qt::EditRole)
return false;
if (index.column() != NR)
return false;
int v = value.toInt();
if (v == 0)
return false;
// Only accept numbers that are not already in use by other dives.
int i;
struct dive *dive;
for_each_dive (i, dive) {
if (dive->number == v)
return false;
}
#if defined(SUBSURFACE_MOBILE)
d->number = v;
#else
Command::editNumber(v, d);
#endif
return true;
}
// Update visibility status of dive and return dives whose visibility changed.
// Attention: the changed dives are removed from the original vector!
static ShownChange updateShown(QVector<dive *> &dives)

View file

@ -70,7 +70,6 @@ public:
Qt::ItemFlags flags(const QModelIndex &index) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
DiveTripModelBase(QObject *parent = 0);
int columnCount(const QModelIndex&) const;