summaryrefslogtreecommitdiffstats
path: root/qt-ui/profilegraphics.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-05-10 15:52:06 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-05-10 15:52:06 -0300
commitad8f96cd6efdec59cbec7e10571de2e9c2496d9e (patch)
tree4e3157649bb51bb7b6c6bd9f1be3b20a04d5b798 /qt-ui/profilegraphics.cpp
parent3e22e388e9c6b3fe2804acc414c96511b738ad57 (diff)
downloadsubsurface-ad8f96cd6efdec59cbec7e10571de2e9c2496d9e.tar.gz
Crash fixed on clicking on the canvas while no dive is loaded.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/profilegraphics.cpp')
-rw-r--r--qt-ui/profilegraphics.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
index 5607cb3b8..c1e51ac25 100644
--- a/qt-ui/profilegraphics.cpp
+++ b/qt-ui/profilegraphics.cpp
@@ -114,7 +114,7 @@ extern struct ev_select *ev_namelist;
extern int evn_allocated;
extern int evn_used;
-ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent) , dive(0)
+ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent) , dive(0), toolTip(0)
{
gc.printer = false;
setScene(new QGraphicsScene());
@@ -139,6 +139,9 @@ ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent
void ProfileGraphicsView::wheelEvent(QWheelEvent* event)
{
+ if (!toolTip)
+ return;
+
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
// Scale the view / do the zoom
@@ -157,6 +160,9 @@ void ProfileGraphicsView::wheelEvent(QWheelEvent* event)
void ProfileGraphicsView::mouseMoveEvent(QMouseEvent* event)
{
+ if (!toolTip)
+ return;
+
toolTip->refresh(&gc, mapToScene(event->pos()));
QPoint toolTipPos = mapFromScene(toolTip->pos());