From f7119bdccfb2c8777d96a53b3f389cd31d605f2d Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 19 Aug 2014 20:59:34 -0500 Subject: Planner: make sure no old handles are around when entering Add/Plan In some cases we don't appear to remove all of the old handles from the scene and end up showing a handle from a previous instance of the planner in the upper right corner of the profile. This patch makes sure that we remove any stray handles that might still be around before entereing plan or add mode. Signed-off-by: Dirk Hohndel --- qt-ui/profile/profilewidget2.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'qt-ui/profile/profilewidget2.cpp') 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()); -- cgit v1.2.3-70-g09d2