changeset 31191:bb9d776eafac stable

Fix wrong color in PDF printout of some latex strings (bug #62884) * octave-svgconvert (draw): For "rect" elements only set brush color if necessary and eventually restore to previous color.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Sun, 14 Aug 2022 18:24:07 +0200
parents 820d2c802247
children 7401a2501be4 6bcc5e6d77fe
files src/octave-svgconvert.cc
diffstat 1 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/octave-svgconvert.cc	Mon Aug 15 00:22:55 2022 +0200
+++ b/src/octave-svgconvert.cc	Sun Aug 14 18:24:07 2022 +0200
@@ -660,12 +660,6 @@
         }
       else if (elt.tagName () == "rect")
         {
-          // Color
-          QColor col (Qt::black);
-          QString str = elt.attribute ("fill");
-          if (! str.isEmpty ())
-            col = QColor (str);
-
           // Position
           double x = elt.attribute ("x").toDouble ();
           double y = elt.attribute ("y").toDouble ();
@@ -674,10 +668,19 @@
           double wd = elt.attribute ("width").toDouble ();
           double hg = elt.attribute ("height").toDouble ();
 
-          painter.setBrush (col);
+          // Color
+          QColor saved_color = painter.brush ().color ();
+
+          QString str = elt.attribute ("fill");
+          if (! str.isEmpty ())
+            painter.setBrush (QColor (str));
+
           painter.setPen (Qt::NoPen);
 
           painter.drawRect (QRectF (x, y, wd, hg));
+
+          if (! str.isEmpty ())
+            painter.setBrush (saved_color);
         }
       else if (elt.tagName () == "polygon")
         {