From 501f72c6976da0893d4e5f9bb82378e41c37f756 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Wed, 14 Jan 2015 14:41:56 -0200 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/profile/profilewidget2.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'qt-ui') 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) { -- cgit v1.2.3-70-g09d2