mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Reduce the refresh rate of the toolTipItem to 25fps.
This reduces a lot of CPU time and makes the overall use of the tooltip a breeze. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
67865a86be
commit
ac40c458fa
2 changed files with 7 additions and 1 deletions
|
@ -159,6 +159,7 @@ ToolTipItem::ToolTipItem(QGraphicsItem *parent) : QGraphicsRectItem(parent),
|
||||||
title->setBrush(Qt::white);
|
title->setBrush(Qt::white);
|
||||||
|
|
||||||
setPen(QPen(Qt::white, 2));
|
setPen(QPen(Qt::white, 2));
|
||||||
|
refreshTime.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolTipItem::~ToolTipItem()
|
ToolTipItem::~ToolTipItem()
|
||||||
|
@ -240,6 +241,10 @@ void ToolTipItem::refresh(const QPointF &pos)
|
||||||
static QPainter painter(&tissues);
|
static QPainter painter(&tissues);
|
||||||
static struct membuffer mb = { 0 };
|
static struct membuffer mb = { 0 };
|
||||||
|
|
||||||
|
if(refreshTime.elapsed() < 40)
|
||||||
|
return;
|
||||||
|
refreshTime.start();
|
||||||
|
|
||||||
int time = timeAxis->valueAt(pos);
|
int time = timeAxis->valueAt(pos);
|
||||||
if (time == lastTime)
|
if (time == lastTime)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QRectF>
|
#include <QRectF>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
#include <QTime>
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
|
||||||
class DiveCartesianAxis;
|
class DiveCartesianAxis;
|
||||||
|
@ -59,7 +60,7 @@ private:
|
||||||
DiveCartesianAxis *timeAxis;
|
DiveCartesianAxis *timeAxis;
|
||||||
plot_info pInfo;
|
plot_info pInfo;
|
||||||
int lastTime;
|
int lastTime;
|
||||||
|
QTime refreshTime;
|
||||||
QList<QGraphicsItem*> oldSelection;
|
QList<QGraphicsItem*> oldSelection;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue