diff options
-rw-r--r-- | qt-ui/profilegraphics.cpp | 12 | ||||
-rw-r--r-- | qt-ui/profilegraphics.h | 1 |
2 files changed, 12 insertions, 1 deletions
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp index c01022799..c2f71be11 100644 --- a/qt-ui/profilegraphics.cpp +++ b/qt-ui/profilegraphics.cpp @@ -194,16 +194,26 @@ static void plot_set_scale(scale_mode_t scale) } } +void ProfileGraphicsView::showEvent(QShowEvent* event) +{ + if (dive) + plot(dive); +} + void ProfileGraphicsView::plot(struct dive *d) { - scene()->clear(); + scene()->clear(); if (dive != d){ resetTransform(); zoomLevel = 0; dive = d; } + if(!isVisible()){ + return; + } + if(!dive) return; diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h index cd87276e3..7cf88cbc3 100644 --- a/qt-ui/profilegraphics.h +++ b/qt-ui/profilegraphics.h @@ -69,6 +69,7 @@ protected: void resizeEvent(QResizeEvent *event); void mouseMoveEvent(QMouseEvent* event); void wheelEvent(QWheelEvent* event); + void showEvent(QShowEvent* event); private: void plot_depth_profile(); |