Dive list: replace dive-id by dive pointer

The undo-system now guarantees that pointers to dives are stable
throughout their lifetime. Therefore, replace the unique index by
pointers. This is a small performance improvement, but much more
importantly, it will make it more natural to transport a pointer
to the dive inside QModelIndex's private pointer.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-09-06 22:15:37 +02:00 committed by Dirk Hohndel
parent dd9af8e72e
commit c341bc53c3
2 changed files with 57 additions and 75 deletions

View file

@ -32,7 +32,7 @@ public:
};
QVariant data(int column, int role) const override;
int diveId;
dive *d;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
QString displayDate() const;
@ -46,7 +46,7 @@ public:
QString displaySac() const;
QString displaySacWithUnit() const;
QString displayTags() const;
int countPhotos(dive *dive) const;
int countPhotos() const;
int weight() const;
};