aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2014-11-17 22:59:19 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-17 21:04:27 +0000
commit609036c57031073b6ae7e829c0473815297b8247 (patch)
tree71f8b531e73cf34d14897f81dfd9bfd0c232cc56 /qt-ui/profile
parentc688cc52e8c295ba1a77553457d97d598c3da51e (diff)
downloadsubsurface-609036c57031073b6ae7e829c0473815297b8247.tar.gz
Ruler: fix weird behaviour near x = 0
RulerNodeItem2::recalculate() does something which is apparently not a good idea in combination with RulerNodeItem2::mouseMoveEvent(). Each time the mouse moves, setPos() is called. Then in recalculate() the x() value is checked and if less than 0 it's changed to x = 0 (setPos(0, y());). This last call (setPos(0, y());) however does not work and the value remains less than zero leaving one of the ruler points outside of the graph. To solve the issue we add a silly explicit check if x() < 0 before calling setPos() in RulerNodeItem2::mouseMoveEvent(). The 'x() > timeAxis->posAtValue(data->sec)' strangely works on the other hand. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile')
-rw-r--r--qt-ui/profile/ruleritem.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/qt-ui/profile/ruleritem.cpp b/qt-ui/profile/ruleritem.cpp
index 0bf97f947..d38e88822 100644
--- a/qt-ui/profile/ruleritem.cpp
+++ b/qt-ui/profile/ruleritem.cpp
@@ -61,7 +61,10 @@ void RulerNodeItem2::recalculate()
void RulerNodeItem2::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
- setPos(event->scenePos());
+ qreal x = event->scenePos().x();
+ if (x < 0.0)
+ x = 0.0;
+ setPos(x, event->scenePos().y());
recalculate();
ruler->recalculate();
}