diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-24 18:54:34 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-24 19:32:10 +0100 |
commit | a88e34b21b07f70123926fcb5c505d6afdf99807 (patch) | |
tree | 905059194dcc64c7c163b8912947d8173fd4cc91 /spline/spline-widget.cpp | |
parent | 5bf85412e4eacf92acc936b6e74bce0e2b1055d9 (diff) |
style/quality only
No functional changes.
- add `override' everywhere where missing
- almost pass clang's `-Wweak-vtables'
- avoid some float/double conversions
- remove unused private members
- make signedness conversions explicit
- put stuff in right namespaces to aid analysis
Diffstat (limited to 'spline/spline-widget.cpp')
-rw-r--r-- | spline/spline-widget.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/spline/spline-widget.cpp b/spline/spline-widget.cpp index 4a591870..36d3e2bf 100644 --- a/spline/spline-widget.cpp +++ b/spline/spline-widget.cpp @@ -107,7 +107,7 @@ void spline_widget::drawBackground() const QPen pen(color__, 1, Qt::SolidLine, Qt::FlatCap); - const int ystep = y_step_, xstep = x_step_; + const int ystep = std::ceil(y_step_), xstep = std::ceil(x_step_); const double maxx = config->max_input(); const double maxy = config->max_output(); @@ -505,7 +505,7 @@ void spline_widget::show_tooltip(const QPoint& pos, const QPointF& value_) double x = value.x(), y = value.y(); if (preview_only) - y = config->get_value_no_save(x); + y = (double)config->get_value_no_save((float)x); const int x_ = iround(x), y_ = iround(y); @@ -515,7 +515,7 @@ void spline_widget::show_tooltip(const QPoint& pos, const QPointF& value_) y = y_; // the style on OSX has different offsets - static const bool is_fusion = + constexpr bool is_fusion = #if defined __APPLE__ true; #else @@ -535,8 +535,8 @@ void spline_widget::show_tooltip(const QPoint& pos, const QPointF& value_) bool spline_widget::is_in_bounds(const QPointF& pos) const { - const int grace = point_size_in_pixels * 3; - const int bottom_grace = int(point_size_in_pixels * 1.5); + const int grace = (int)std::ceil(point_size_in_pixels * 3); + const int bottom_grace = (int)std::ceil(point_size_in_pixels * 1.5); return (pos.x() + grace > pixel_bounds.left() && pos.x() - grace < pixel_bounds.right() && pos.y() + grace > pixel_bounds.top() && |