From 8f8014bf7178c6c06d5bb1760ba6619f161d1ac6 Mon Sep 17 00:00:00 2001
From: Stanislaw Halik <sthalik@misaki.pl>
Date: Fri, 27 Oct 2017 14:08:11 +0200
Subject: spline/widget: try fix background color on Unix

---
 spline/spline-widget.cpp | 8 +++-----
 spline/spline-widget.hpp | 1 +
 2 files changed, 4 insertions(+), 5 deletions(-)

(limited to 'spline')

diff --git a/spline/spline-widget.cpp b/spline/spline-widget.cpp
index 68d009c5..67751840 100644
--- a/spline/spline-widget.cpp
+++ b/spline/spline-widget.cpp
@@ -101,7 +101,7 @@ void spline_widget::drawBackground()
 
     QPainter painter(&_background);
 
-    painter.fillRect(rect(), palette().background().color());
+    painter.fillRect(rect(), widget_bg_color);
 
     {
         QColor bg_color(112, 154, 209);
@@ -253,15 +253,13 @@ 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);
+    painter.fillRect(r1, widget_bg_color);
     // same for rightward artifacts
-    painter.fillRect(r2, bg);
+    painter.fillRect(r2, widget_bg_color);
 
     const int alpha = !isEnabled() ? 64 : 120;
     if (!_preview_only)
diff --git a/spline/spline-widget.hpp b/spline/spline-widget.hpp
index 711bdb2a..d38eeeee 100644
--- a/spline/spline-widget.hpp
+++ b/spline/spline-widget.hpp
@@ -90,6 +90,7 @@ private:
     QPixmap _background;
     QPixmap _function;
     QColor spline_color;
+    QColor widget_bg_color = palette().background().color();
 
     // bounds of the rectangle user can interact with
     QRect pixel_bounds;
-- 
cgit v1.2.3