summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-01-14 14:41:56 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-15 07:24:13 +1300
commit501f72c6976da0893d4e5f9bb82378e41c37f756 (patch)
treeea109d91140cbd77c09a298f7deed71cc50f726d /qt-ui/profile
parentdb4ffd0b703b43f60b0802a21b434dd5b87f6be4 (diff)
downloadsubsurface-501f72c6976da0893d4e5f9bb82378e41c37f756.tar.gz
Speed Improvemens: fewer calls to mapFromScene / mapToScene
We did three cals to mapToScene / mapFromScene on the mouse moveEvent at the ProfileWidget2 where we only needed to call one in the common case and two in the worst case. This doesn't really help in terms of speed (unless you have a really old cpu) but since it's code that gets called *very* often, it seemed a reasonable thing to do. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile')
-rw-r--r--qt-ui/profile/profilewidget2.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 87339e2f1..b161032d4 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -814,16 +814,16 @@ void ProfileWidget2::scrollViewTo(const QPoint &pos)
void ProfileWidget2::mouseMoveEvent(QMouseEvent *event)
{
- toolTipItem->refresh(mapToScene(event->pos()));
- QPoint toolTipPos = mapFromScene(toolTipItem->pos());
+ QPointF pos = mapToScene(event->pos());
+ toolTipItem->refresh(pos);
if (zoomLevel == 0) {
QGraphicsView::mouseMoveEvent(event);
} else {
+ QPoint toolTipPos = mapFromScene(toolTipItem->pos());
scrollViewTo(event->pos());
toolTipItem->setPos(mapToScene(toolTipPos));
}
- QPointF pos = mapToScene(event->pos());
qreal vValue = profileYAxis->valueAt(pos);
qreal hValue = timeAxis->valueAt(pos);
if (profileYAxis->maximum() >= vValue && profileYAxis->minimum() <= vValue) {