From 3b5a3500766abd38907824a8b02991708309488e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 21 Oct 2017 11:47:58 +0200 Subject: spline/widget: fixes - fix horizontal legend overwritten by bg color - same fix for point circles - don't blit rectangles in paintEvent, cache them --- spline/spline-widget.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'spline') diff --git a/spline/spline-widget.cpp b/spline/spline-widget.cpp index aac4ef9c..ba0aa44c 100644 --- a/spline/spline-widget.cpp +++ b/spline/spline-widget.cpp @@ -257,6 +257,16 @@ void spline_widget::drawFunction() } #endif + const QColor bg = palette().background().color(); + + const QRect r1(pixel_bounds.left(), 0, width() - pixel_bounds.left(), pixel_bounds.top()), + r2(pixel_bounds.right(), 0, width() - pixel_bounds.right(), pixel_bounds.bottom()); + + // prevent topward artifacts the lazy way + painter.fillRect(r1, bg); + // same for rightward artifacts + painter.fillRect(r2, bg); + const int alpha = !isEnabled() ? 64 : 120; if (!_preview_only) { @@ -305,16 +315,6 @@ void spline_widget::paintEvent(QPaintEvent *e) QPointF last; if (_config->get_last_value(last) && isEnabled()) drawPoint(p, point_to_pixel(last), QColor(255, 0, 0, 120)); - - const QColor bg = palette().background().color(); - - const QRect r1(pixel_bounds.left(), 0, width() - pixel_bounds.left(), pixel_bounds.top()), - r2(pixel_bounds.right(), 0, width() - pixel_bounds.right(), height()); - - // prevent topward artifacts the lazy way - p.fillRect(r1, bg); - // same for rightward artifacts - p.fillRect(r2, bg); } void spline_widget::drawPoint(QPainter& painter, const QPointF& pos, const QColor& colBG, const QColor& border) -- cgit v1.2.3