aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/profile')
-rw-r--r--qt-ui/profile/profilewidget2.cpp12
-rw-r--r--qt-ui/profile/profilewidget2.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 409328918..7a5722082 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -854,12 +854,23 @@ void ProfileWidget2::setProfileState()
mouseFollowerVertical->setVisible(false);
}
+void ProfileWidget2::clearHandlers()
+{
+ if (handles.count()) {
+ foreach (DiveHandler *handle, handles) {
+ scene()->removeItem(handle);
+ }
+ handles.clear();
+ }
+}
+
void ProfileWidget2::setAddState()
{
if (currentState == ADD)
return;
setProfileState();
+ clearHandlers();
mouseFollowerHorizontal->setVisible(true);
mouseFollowerVertical->setVisible(true);
mouseFollowerHorizontal->setLine(timeAxis->line());
@@ -893,6 +904,7 @@ void ProfileWidget2::setPlanState()
return;
setProfileState();
+ clearHandlers();
mouseFollowerHorizontal->setVisible(true);
mouseFollowerVertical->setVisible(true);
mouseFollowerHorizontal->setLine(timeAxis->line());
diff --git a/qt-ui/profile/profilewidget2.h b/qt-ui/profile/profilewidget2.h
index fa5e53e26..dc08be3d7 100644
--- a/qt-ui/profile/profilewidget2.h
+++ b/qt-ui/profile/profilewidget2.h
@@ -175,6 +175,7 @@ private:
QList<DivePictureItem*> pictures;
void repositionDiveHandlers();
int fixHandlerIndex(DiveHandler *activeHandler);
+ void clearHandlers();
friend class DiveHandler;
QHash<Qt::Key, QAction *> actionsForKeys;
bool shouldCalculateMaxTime;