summaryrefslogtreecommitdiffstats
path: root/qt-ui/profilegraphics.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-05-16 16:00:33 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-16 12:23:38 -0700
commitd39b1aedcd9dedecfca54c91661a81406b80c6ec (patch)
tree722d67b585e200cd298058308563aeca78c85a29 /qt-ui/profilegraphics.cpp
parente3cb36498d97750a9a961be21f5adb9073fa6863 (diff)
downloadsubsurface-d39b1aedcd9dedecfca54c91661a81406b80c6ec.tar.gz
Fix loading a second dive, after the first file was loaded.
This patch fixes loading a second dive-file after the first one had been loaded. it simply clears some information and makes sure that the current selected dive is invalid when the file closes. I also did a bit of code cleanup on this one to make things simpler in the future. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profilegraphics.cpp')
-rw-r--r--qt-ui/profilegraphics.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
index e5212be1e..8ab4aa845 100644
--- a/qt-ui/profilegraphics.cpp
+++ b/qt-ui/profilegraphics.cpp
@@ -206,16 +206,21 @@ void ProfileGraphicsView::showEvent(QShowEvent* event)
plot(dive);
}
+void ProfileGraphicsView::clear()
+{
+ scene()->clear();
+ resetTransform();
+ zoomLevel = 0;
+ toolTip = 0;
+}
+
void ProfileGraphicsView::plot(struct dive *d)
{
+ if (dive == d)
+ return;
- scene()->clear();
- if (dive != d){
- resetTransform();
- zoomLevel = 0;
- dive = d;
- toolTip = 0;
- }
+ clear();
+ dive = d;
if(!isVisible() || !dive){
return;