From da71bbd53358160c2552fa17ec9fe2b5655822dd Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 22 Jul 2016 10:10:14 +0200 Subject: spline-widget: round upward resulting position --- spline-widget/qfunctionconfigurator.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spline-widget/qfunctionconfigurator.cpp b/spline-widget/qfunctionconfigurator.cpp index be6e9e88..6f08389f 100644 --- a/spline-widget/qfunctionconfigurator.cpp +++ b/spline-widget/qfunctionconfigurator.cpp @@ -436,8 +436,10 @@ QPointF QFunctionConfigurator::pixel_coord_to_point(const QPointF& point) if (!_config) return QPointF(-1, -1); - qreal x = (point.x() - pixel_bounds.x()) / c.x(); - qreal y = (pixel_bounds.height() - point.y() + pixel_bounds.y()) / c.y(); + using std::round; + + qreal x = round((point.x() - pixel_bounds.x()) / c.x()); + qreal y = round((pixel_bounds.height() - point.y() + pixel_bounds.y()) / c.y()); if (snap_x > 0) x -= int(x) % snap_x; -- cgit v1.2.3