mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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 <dirk@hohndel.org>
This commit is contained in:
parent
13e2210d75
commit
ae2f18678d
2 changed files with 3 additions and 6 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -335,13 +335,12 @@ void ProfileWidget2::plotDives(QList<dive *> 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
|
||||
|
|
Loading…
Add table
Reference in a new issue