Gradient drawing in SvgGenerator

  • Deal Fellow Qt-Folks!

    I'm trying to export a drawing (QPicture) in svg format. It contains Circles that should be filled with a radial gradient. Problem is, that gradients are very well drawn when the picture is rendered to a Widget's PaintDevice; but not when exported to svg.

    The SVG file contains the gradient definitions, but they are not assigned to the circles as filling.

    Drawing like this :
    @QRadialGradient grad(x, y, 3, x-2, y-1);
    grad.setColorAt(0, Qt::white);
    grad.setColorAt(1, color);
    painter.setBrush(grad); //QBrush(color));
    painter.drawEllipse(x, y, 5, 5);@

    I put the drawing to the SvgGenerator like this:
    @QSvgGenerator generator;
    QPainter painter(&generator);

    what works is to fill the circles with a Qt::SolidPattern. (commented out)

    any Ideas? Is this a bug? Or should I export my Picture differently?


  • I'd say: bug. File a report, with a simple testcase please.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.