[Qgis-developer] how to know if QPainter comes from a print job ?

Marco Hugentobler marco.hugentobler at sourcepole.ch
Mon Nov 4 07:40:29 PST 2013


>The  ScaleFactor is distinct of 1 when the composition engine must paint 
the map to one specific map scale.

I think you are mixing up QgsRenderContext::scaleFactor() and 
QgsRenderContext::rendererScale().

Regards,
Marco

On 04.11.2013 16:29, A Huarte wrote:
> Hi, Marco, finally I added a flag in 'QgsRenderContext' class 
> indicating that it works in a 'print composition' task.
> The ScaleFactor is distinct of 1 when the composition engine must 
> paint the map to one specific map scale.
>
> At any rate, thank you very much!
>
>
>
>     ------------------------------------------------------------------------
>     *De:* Marco Hugentobler <marco.hugentobler at sourcepole.ch>
>     *Para:* qgis-developer at lists.osgeo.org
>     *Enviado:* Lunes 4 de noviembre de 2013 11:37
>     *Asunto:* Re: [Qgis-developer] how to know if QPainter comes from
>     a print job ?
>
>     Hi
>
>     You cannot get that information from the painter itself (a print
>     composition can be printed into QImage, pdf, QPrinter, etc...).
>     The safest guess is probably to look at the QgsRenderContext. If
>     the parameter 'scaleFactor' is very close to 1.0, it is most
>     likely the rendering comes from a print composition.
>
>     Regards,
>     Marco
>
>     On 04.11.2013 11:28, A Huarte wrote:
>>     Hi!
>>
>>     Within of qgis_core I need know if a QgsRenderContext comes from
>>     a print job (from composer) in order to disable one functionality.
>>
>>     I get that information from QPainter, QPaintDevice,
>>     QPaintEngine::Type ?
>>
>>     Thank your very much!
>>
>>
>>
>>     _______________________________________________
>>     Qgis-developer mailing list
>>     Qgis-developer at lists.osgeo.org  <mailto: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  <mailto:marco.hugentobler at sourcepole.ch>  http://www.sourcepole.ch  <http://www.sourcepole.ch/>
>     Technical Advisor QGIS Project Steering Committee
>
>
>     _______________________________________________
>     Qgis-developer mailing list
>     Qgis-developer at lists.osgeo.org <mailto: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


-- 
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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20131104/39e20faf/attachment.html>


More information about the Qgis-developer mailing list