From 56c4cced536b8b1bb7282f263deb24640632e884 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Fri, 10 May 2013 14:18:33 -0300 Subject: Fixed loading the first dive via command line on the profile. Signed-off-by: Tomaz Canabrava --- qt-ui/profilegraphics.cpp | 12 +++++++++++- qt-ui/profilegraphics.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) 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(); -- cgit v1.2.3-70-g09d2