From ae2f18678d72ab700b09435b53b7d4ba6292d466 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 13 Mar 2014 10:23:20 -0700 Subject: New profile: fix Information overlay location By simply storing the coordinates based on the scene (instead of trying to map them to real coordinates) the overlay position is correctly restored. Also remove the redundant positioning before readPos is called. Signed-off-by: Dirk Hohndel --- qt-ui/profile/divetooltipitem.cpp | 6 ++---- qt-ui/profile/profilewidget2.cpp | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/profile/divetooltipitem.cpp b/qt-ui/profile/divetooltipitem.cpp index c11266a5a..0e68685b9 100644 --- a/qt-ui/profile/divetooltipitem.cpp +++ b/qt-ui/profile/divetooltipitem.cpp @@ -184,10 +184,9 @@ void ToolTipItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void ToolTipItem::persistPos() { - QPoint currentPos = scene()->views().at(0)->mapFromScene(pos()); QSettings s; s.beginGroup("ProfileMap"); - s.setValue("tooltip_position", currentPos); + s.setValue("tooltip_position", pos()); s.endGroup(); } @@ -195,8 +194,7 @@ void ToolTipItem::readPos() { QSettings s; s.beginGroup("ProfileMap"); - QPointF value = scene()->views().at(0)->mapToScene( - s.value("tooltip_position").toPoint()); + QPointF value = s.value("tooltip_position").toPoint(); if (!scene()->sceneRect().contains(value)) { value = QPointF(0, 0); } diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index 2cdff1cff..f16b3a48d 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -335,13 +335,12 @@ void ProfileWidget2::plotDives(QList dives) firstCall = false; } - // restore default zoom level and tooltip position + // restore default zoom level if (zoomLevel) { const qreal defScale = 1.0 / qPow(zoomFactor, (qreal)zoomLevel); scale(defScale, defScale); zoomLevel = 0; } - toolTipItem->setPos(0, 0); // No need to do this again if we are already showing the same dive // computer of the same dive, so we check the unique id of the dive -- cgit v1.2.3-70-g09d2