summaryrefslogtreecommitdiffstats
path: root/profile-widget
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-09 18:11:56 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-01-10 15:57:39 -0800
commit54e8fe5d9e588c3345ded27982edaf72654fc8d1 (patch)
tree14460c74f1a9bf9cdd228a933fac509bf39043a2 /profile-widget
parent193513a61fc7fcfb31c1cb969f7fe05452abd67c (diff)
downloadsubsurface-54e8fe5d9e588c3345ded27982edaf72654fc8d1.tar.gz
profile: pass dive to ToolTipItem::refresh()
Don't access the global displayed_dive variable in a step to make the profile reentrant. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'profile-widget')
-rw-r--r--profile-widget/divetooltipitem.cpp4
-rw-r--r--profile-widget/divetooltipitem.h2
-rw-r--r--profile-widget/profilewidget2.cpp4
3 files changed, 5 insertions, 5 deletions
diff --git a/profile-widget/divetooltipitem.cpp b/profile-widget/divetooltipitem.cpp
index f61471be5..2f4be8925 100644
--- a/profile-widget/divetooltipitem.cpp
+++ b/profile-widget/divetooltipitem.cpp
@@ -222,7 +222,7 @@ void ToolTipItem::setTimeAxis(DiveCartesianAxis *axis)
timeAxis = axis;
}
-void ToolTipItem::refresh(const QPointF &pos)
+void ToolTipItem::refresh(const dive *d, const QPointF &pos)
{
static QPixmap tissues(16,60);
static QPainter painter(&tissues);
@@ -238,7 +238,7 @@ void ToolTipItem::refresh(const QPointF &pos)
clear();
mb.len = 0;
- int idx = get_plot_details_new(&pInfo, time, &mb);
+ int idx = get_plot_details_new(d, &pInfo, time, &mb);
tissues.fill();
painter.setPen(QColor(0, 0, 0, 0));
diff --git a/profile-widget/divetooltipitem.h b/profile-widget/divetooltipitem.h
index c9e61b6d4..cb18b34df 100644
--- a/profile-widget/divetooltipitem.h
+++ b/profile-widget/divetooltipitem.h
@@ -36,7 +36,7 @@ public:
void expand();
void clear();
void addToolTip(const QString &toolTip, const QIcon &icon = QIcon(), const QPixmap &pixmap = QPixmap());
- void refresh(const QPointF &pos);
+ void refresh(const dive *d, const QPointF &pos);
bool isExpanded() const;
void persistPos();
void readPos();
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index 7397d1648..49f99d20c 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -809,7 +809,7 @@ void ProfileWidget2::plotDive(const struct dive *d, bool force, bool doClearPict
else
plotPicturesInternal(d, instant);
- toolTipItem->refresh(mapToScene(mapFromGlobal(QCursor::pos())));
+ toolTipItem->refresh(&displayed_dive, mapToScene(mapFromGlobal(QCursor::pos())));
#endif
// OK, how long did this take us? Anything above the second is way too long,
@@ -1025,7 +1025,7 @@ void ProfileWidget2::scrollViewTo(const QPoint &pos)
void ProfileWidget2::mouseMoveEvent(QMouseEvent *event)
{
QPointF pos = mapToScene(event->pos());
- toolTipItem->refresh(mapToScene(mapFromGlobal(QCursor::pos())));
+ toolTipItem->refresh(&displayed_dive, mapToScene(mapFromGlobal(QCursor::pos())));
if (zoomLevel == 0) {
QGraphicsView::mouseMoveEvent(event);