Vincent highlighted a hack in the composer PDF rendering (made by Marco) [1].<div>I was trying to reproduce it in Python, to test if it can solve some problems in the Atlas plugin.</div><div>I thought I could use the QPrinter.setEngines() method [2], to set an instance of a derived QPaintEngine intitated with the flags provided in the hack, but this method makes QGis crash. I was doing something like this (excerpt):</div>
<div><br></div><div>paintE = self.getHackedPaintEngine</div><div>printE = printer.printEngine()</div><div>printer.setEngines(printE,paintE)</div><div><br></div><div><div>def getHackedPaintEngine(self):</div><div>        class HackEngine(QPaintEngine):</div>
<div>            def __init__(self):</div><div>                QPaintEngine.__init__(self,</div><div>                    QPaintEngine.PrimitiveTransform</div><div>                  | QPaintEngine.PixmapTransform</div><div>
                  | QPaintEngine.PatternBrush</div><div>                  | QPaintEngine.AlphaBlend</div><div>                  | QPaintEngine.PainterPaths</div><div>                  | QPaintEngine.Antialiasing</div><div>
                  | QPaintEngine.BrushStroke</div><div>                  | QPaintEngine.ConstantOpacity</div><div>                  | QPaintEngine.MaskedBrush</div><div>                  | QPaintEngine.BlendModes</div><div>
                  | QPaintEngine.RasterOpModes</div><div>                )</div><div>        </div><div><span class="Apple-tab-span" style="white-space:pre">             </span>return HackEngine()</div></div><div><div><br></div><div>
What alternative way would you suggest to reproduce the hack?</div><div>giovanni</div><div><br></div><div>[1] <a href="https://github.com/qgis/Quantum-GIS/blob/master/src/app/composer/qgscomposer.cpp#L588">https://github.com/qgis/Quantum-GIS/blob/master/src/app/composer/qgscomposer.cpp#L588</a></div>
</div><div>[2] <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qprinter.html#setEngines">http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qprinter.html#setEngines</a></div>