mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Only recalculate the tooltip if time has changed
Small optimization, but seems to make sense. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
43997d3b36
commit
08490785b2
2 changed files with 8 additions and 2 deletions
|
@ -144,7 +144,8 @@ ToolTipItem::ToolTipItem(QGraphicsItem* parent) : QGraphicsPathItem(parent),
|
|||
separator(new QGraphicsLineItem(this)),
|
||||
title(new QGraphicsSimpleTextItem(tr("Information"), this)),
|
||||
status(COLLAPSED),
|
||||
timeAxis(0)
|
||||
timeAxis(0),
|
||||
lastTime(-1)
|
||||
{
|
||||
memset(&pInfo, 0, sizeof(pInfo));
|
||||
|
||||
|
@ -231,8 +232,12 @@ void ToolTipItem::setTimeAxis(DiveCartesianAxis* axis)
|
|||
|
||||
void ToolTipItem::refresh(const QPointF& pos)
|
||||
{
|
||||
clear();
|
||||
int time = timeAxis->valueAt( pos );
|
||||
if (time == lastTime)
|
||||
return;
|
||||
|
||||
lastTime = time;
|
||||
clear();
|
||||
struct membuffer mb = { 0 };
|
||||
|
||||
get_plot_details_new(&pInfo, time, &mb);
|
||||
|
|
|
@ -56,6 +56,7 @@ private:
|
|||
QRectF nextRectangle;
|
||||
DiveCartesianAxis *timeAxis;
|
||||
plot_info pInfo;
|
||||
int lastTime;
|
||||
};
|
||||
|
||||
#endif // DIVETOOLTIPITEM_H
|
||||
|
|
Loading…
Add table
Reference in a new issue