summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-10-21 11:47:58 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-10-21 11:47:58 +0200
commit3b5a3500766abd38907824a8b02991708309488e (patch)
tree01bb237f311cd289a99eb95024f8541cb13f4dd1
parente0fc250a3d9b11da09ccb98ec7f3ff22335702ac (diff)
spline/widget: fixes
- fix horizontal legend overwritten by bg color - same fix for point circles - don't blit rectangles in paintEvent, cache them
-rw-r--r--spline/spline-widget.cpp20
1 files changed, 10 insertions, 10 deletions
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)