[Qgis-developer] porting the composer QPaintEngine hack to Python?

John C. Tull jctull at gmail.com
Tue Jul 10 08:53:50 PDT 2012


I can confirm success on my OSX system also with the patch you supplied, Giovanni. Cheers,
John

On Jul 9, 2012, at 8:13 AM, G. Allegri wrote:

> The hack is working perfectly! 
> Tha Atlas plugin seems to be working now ;)
> 
> giovanni
> 
> 2012/7/5 G. Allegri <giohappy at gmail.com>
> Thanks to Jef, the hacked engine is exposed throug sip now ;)
> I will try it ASAP.
> 
> giovanni
> 
> 2012/7/5 G. Allegri <giohappy at gmail.com>
> I fear it isn't possible (at least with common programming skills!) to reproduce it.
> My approach was too naive. The paintEngine instance is a pointer to a subclass implementation, and AFACS there's no method to change the flags (render features) of an instanciated engine...
> 
> giovanni
> 
> 2012/7/5 G. Allegri <giohappy at gmail.com>
> 
> 
> 
> 2012/7/5 Marco Hugentobler <marco.hugentobler at sourcepole.ch>
> >made by Marco
> 
> made by Jürgen (it fixes the pdf shift on windows).
> 
> ops, sorry :)
>  
> 
> Marco
> 
> Am 05.07.2012 16:11, schrieb G. Allegri:
>> Vincent highlighted a hack in the composer PDF rendering (made by Marco) [1].
>> I was trying to reproduce it in Python, to test if it can solve some problems in the Atlas plugin.
>> 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):
>> 
>> paintE = self.getHackedPaintEngine
>> printE = printer.printEngine()
>> printer.setEngines(printE,paintE)
>> 
>> def getHackedPaintEngine(self):
>>         class HackEngine(QPaintEngine):
>>             def __init__(self):
>>                 QPaintEngine.__init__(self,
>>                     QPaintEngine.PrimitiveTransform
>>                   | QPaintEngine.PixmapTransform
>>                   | QPaintEngine.PatternBrush
>>                   | QPaintEngine.AlphaBlend
>>                   | QPaintEngine.PainterPaths
>>                   | QPaintEngine.Antialiasing
>>                   | QPaintEngine.BrushStroke
>>                   | QPaintEngine.ConstantOpacity
>>                   | QPaintEngine.MaskedBrush
>>                   | QPaintEngine.BlendModes
>>                   | QPaintEngine.RasterOpModes
>>                 )
>>         
>>  return HackEngine()
>> 
>> What alternative way would you suggest to reproduce the hack?
>> giovanni
>> 
>> [1] https://github.com/qgis/Quantum-GIS/blob/master/src/app/composer/qgscomposer.cpp#L588
>> [2] http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qprinter.html#setEngines
>> 
>> 
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
> 
> 
> -- 
> Dr. Marco Hugentobler
> Sourcepole -  Linux & Open Source Solutions
> Weberstrasse 5, CH-8004 Zürich, Switzerland
> marco.hugentobler at sourcepole.ch http://www.sourcepole.ch
> Technical Advisor QGIS Project Steering Committee
> 
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
> 
> 
> 
> 
> 
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20120710/793e7961/attachment.html>


More information about the Qgis-developer mailing list