aboutsummaryrefslogtreecommitdiffstats
path: root/profile-widget/profilewidget2.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-24 23:29:28 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-04-02 13:53:23 -0700
commit79ddb23edfb28da8445ec9c7e79f79a62881b715 (patch)
tree6eb4e41d126f425253272a10a304a176327a447b /profile-widget/profilewidget2.h
parent396758d4896197be9dd9f6d71e094068203e52a6 (diff)
downloadsubsurface-79ddb23edfb28da8445ec9c7e79f79a62881b715.tar.gz
profile: implement proper model/view semantics in ProfileWidget2
The ProfileWidget2 slots, which reacted to model changes were broken. They did not add / remove items at the changed positions, but arbitrarily at the end. Moreover, they assumed that only a single item was added / removed and thus violated the model/view API. This worked because the handles are completely reset after each operation and the model only ever touched single items. Nevertheless, this has to be fixed if we ever want finer grained undo. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'profile-widget/profilewidget2.h')
-rw-r--r--profile-widget/profilewidget2.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h
index 395832d40..51cf2f28c 100644
--- a/profile-widget/profilewidget2.h
+++ b/profile-widget/profilewidget2.h
@@ -112,8 +112,10 @@ slots: // Necessary to call from QAction's signals.
void picturesAdded(dive *d, QVector<PictureObj> pics);
void setPlanState();
void setAddState();
+ void pointsReset();
void pointInserted(const QModelIndex &parent, int start, int end);
void pointsRemoved(const QModelIndex &, int start, int end);
+ void pointsMoved(const QModelIndex &, int start, int end, const QModelIndex &destination, int row);
void updateThumbnail(QString filename, QImage thumbnail, duration_t duration);
void profileChanged(dive *d);
void pictureOffsetChanged(dive *d, QString filename, offset_t offset);
@@ -256,6 +258,8 @@ private:
#ifndef SUBSURFACE_MOBILE
void repositionDiveHandlers();
int fixHandlerIndex(DiveHandler *activeHandler);
+ DiveHandler *createHandle();
+ QGraphicsSimpleTextItem *createGas();
#endif
friend class DiveHandler;
QHash<Qt::Key, QAction *> actionsForKeys;