Profile: show correct info box for multiple DCs

Update the dive info box when toggling the chosen DC using the
keyboard. The keyboard toggle does not generate a mouse move
event, so this data was not repainted. For this, a
sub-optimization of not repainting when not moving the mouse
had to be removed. This does not impact ant performance
as 99.9999% of the calls of the repaint are caused by mouse
movement anyway.

Fixes: #1802

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
Jan Mulder 2018-10-17 11:28:33 +02:00 committed by Dirk Hohndel
parent cc225a44f2
commit c986940630
2 changed files with 4 additions and 3 deletions

View file

@ -240,8 +240,6 @@ void ToolTipItem::refresh(const QPointF &pos)
refreshTime.start();
int time = lrint(timeAxis->valueAt(pos));
if (time == lastTime)
return;
lastTime = time;
clear();

View file

@ -828,6 +828,8 @@ void ProfileWidget2::plotDive(struct dive *d, bool force, bool doClearPictures)
clearPictures();
else
plotPictures();
toolTipItem->refresh(mapToScene(mapFromGlobal(QCursor::pos())));
#endif
// OK, how long did this take us? Anything above the second is way too long,
@ -1066,7 +1068,8 @@ void ProfileWidget2::scrollViewTo(const QPoint &pos)
void ProfileWidget2::mouseMoveEvent(QMouseEvent *event)
{
QPointF pos = mapToScene(event->pos());
toolTipItem->refresh(pos);
toolTipItem->refresh(mapToScene(mapFromGlobal(QCursor::pos())));
if (zoomLevel == 0) {
QGraphicsView::mouseMoveEvent(event);
} else {