<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt"><div id="yiv6843595713"><div><div style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"><div id="yiv6843595713yui_3_13_0_6_1383579702577_10"><span id="yiv6843595713yui_3_13_0_6_1383579702577_20">Hi Marco, in "QgsMapRenderer::render" method there is....</span></div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span id="yiv6843595713yui_3_13_0_6_1383579702577_23"><br clear="none"></span></div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="color: rgb(0, 0, 0); font-size:
16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span id="yiv6843595713yui_3_13_0_6_1383579702577_35">...</span></div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;"> //calculate scale factor</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;"> //use the specified dpi and not those from the paint device</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;"> //because sometimes QPainter units are in a local coord sys (e.g. in case of QGraphicsScene)</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;"> double sceneDpi = mScaleCalculator->dpi();</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;"> double
scaleFactor = 1.0;</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;"> if ( mOutputUnits == QgsMapRenderer::Millimeters )</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;"> {</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;"> if ( forceWidthScale )</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;"> {</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;"> scaleFactor = *forceWidthScale; <------------------------ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;"> }</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;">
else</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;"> {</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;"> scaleFactor = sceneDpi / 25.4;</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;"> }</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;"> }</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;"><span id="yiv6843595713yui_3_13_0_6_1383579702577_60" style="background-color:transparent;font-size:12pt;">...</span></div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color: transparent; color: rgb(0, 0, 0); font-size: 12pt; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal;"><span
id="yiv6843595713yui_3_13_0_6_1383579702577_61" style="background-color:transparent;font-size:12pt;"> if ( mRenderContext.scaleFactor() != scaleFactor )</span><br clear="none"></div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;"> {</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;"> mRenderContext.setScaleFactor( scaleFactor );</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;"> mySameAsLastFlag = false;</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;"><span id="yiv6843595713yui_3_13_0_6_1383579702577_26"></span></div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;"> }</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_10" style="background-color:transparent;">...</div><div
id="yiv6843595713yui_3_13_0_6_1383579702577_31"><br clear="none"></div><div id="yiv6843595713yui_3_13_0_6_1383579702577_31">I have debugged the code and I have verified.</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_31">:-)</div><div id="yiv6843595713yui_3_13_0_6_1383579702577_31"><br></div><div id="yiv6843595713yui_3_13_0_6_1383579702577_31"><br></div><div id="yiv6843595713yui_3_13_0_1_1383579702577_2990"><br clear="none" id="yiv6843595713yui_3_13_0_6_1383579702577_12"></div><blockquote id="yiv6843595713yui_3_13_0_6_1383579702577_15" style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;margin-top:5px;padding-left:5px;"> <div class="yiv6843595713yui_3_13_0_1_1383579702577_2728" id="yiv6843595713yui_3_13_0_1_1383579702577_2993" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"> <div class="yiv6843595713yui_3_13_0_1_1383579702577_2729"
id="yiv6843595713yui_3_13_0_1_1383579702577_2992" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"> <div class="yiv6843595713yqt1285260758" id="yiv6843595713yqt20402"><div dir="ltr" id="yiv6843595713yui_3_13_0_1_1383579702577_2991"> <hr id="yiv6843595713yui_3_13_0_1_1383579702577_3533" size="1"> <font id="yiv6843595713yui_3_13_0_1_1383579702577_2994" size="2" face="Arial"> <b><span style="font-weight:bold;">De:</span></b> Marco Hugentobler <marco.hugentobler@sourcepole.ch><br clear="none"> <b><span style="font-weight:bold;">Para:</span></b> qgis-developer@lists.osgeo.org <br clear="none"> <b><span style="font-weight:bold;">Enviado:</span></b> Lunes 4 de noviembre de 2013 16:40<br clear="none"> <b><span style="font-weight:bold;">Asunto:</span></b> Re: [Qgis-developer] how to know if QPainter comes from a print job ?<br clear="none"> </font> </div> <div
class="yiv6843595713y_msg_container" id="yiv6843595713yui_3_13_0_1_1383579702577_2995"><br clear="none"><div id="yiv6843595713"><div id="yiv6843595713yui_3_13_0_1_1383579702577_2997">
<div class="yiv6843595713moz-cite-prefix" id="yiv6843595713yui_3_13_0_1_1383579702577_2996"><span id="yiv6843595713yui_3_13_0_1_1383579702577_3274" style="font-size:12pt;">>The
ScaleFactor is distinct of 1 when the composition engine must
paint the map to one specific map scale.</span><br clear="none">
<br clear="none">
I think you are mixing up QgsRenderContext::scaleFactor() and
QgsRenderContext::rendererScale().<br clear="none">
<br clear="none">
Regards,<br clear="none">
Marco<br clear="none">
<br clear="none">
On 04.11.2013 16:29, A Huarte wrote:<br clear="none">
</div>
<blockquote id="yiv6843595713yui_3_13_0_1_1383579702577_3001" type="cite">
<div class="yiv6843595713yqt1497702274" id="yiv6843595713yqt77767"><div class="yiv6843595713yui_3_13_0_1_1383579702577_2736" id="yiv6843595713yui_3_13_0_1_1383579702577_3000" style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;">
<div id="yiv6843595713yui_3_13_0_1_1383579702577_3018"><span>Hi, Marco, finally I added a flag in '</span><span id="yiv6843595713yui_3_13_0_1_1383579702577_3532" style="font-size:12pt;">QgsRenderContext</span><span id="yiv6843595713yui_3_13_0_1_1383579702577_3017" style="font-size:12pt;">' class indicating that it works in
a 'print composition' task.</span></div>
<div class="yiv6843595713yui_3_13_0_1_1383579702577_2739" id="yiv6843595713yui_3_13_0_1_1383579702577_2999" style="color: rgb(0, 0, 0); font-size: 12pt; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span id="yiv6843595713yui_3_13_0_1_1383579702577_2998" style="font-size:12pt;">The
ScaleFactor is distinct of 1 when the composition engine
must paint the map to one specific map scale.</span></div>
<div class="yiv6843595713yui_3_13_0_1_1383579702577_2741" id="yiv6843595713yui_3_13_0_1_1383579702577_3002" style="color: rgb(0, 0, 0); font-size: 12pt; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><br clear="none">
</div>
<div style="background-color:transparent;"><span>At any rate,
thank you very much!<br clear="none">
</span></div>
<div class="yiv6843595713yui_3_13_0_1_1383579702577_2743" id="yiv6843595713yui_3_13_0_1_1383579702577_3003" style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal;"><span><br clear="none">
</span></div>
<div class="yiv6843595713yui_3_13_0_1_1383579702577_2744" id="yiv6843595713yui_3_13_0_1_1383579702577_3275" style="color: rgb(0, 0, 0); font-size: 12pt; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span style="font-size:12pt;"><br clear="none">
</span></div>
<div id="yiv6843595713yui_3_13_0_1_1383579702577_3004"><br clear="none">
</div>
<blockquote id="yiv6843595713yui_3_13_0_1_1383579702577_3008" style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;margin-top:5px;padding-left:5px;">
<div class="yiv6843595713yui_3_13_0_1_1383579702577_2747" id="yiv6843595713yui_3_13_0_1_1383579702577_3007" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;">
<div class="yiv6843595713yui_3_13_0_1_1383579702577_2748" id="yiv6843595713yui_3_13_0_1_1383579702577_3006" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;">
<div dir="ltr" id="yiv6843595713yui_3_13_0_1_1383579702577_3005">
<hr size="1"> <font face="Arial" size="2"> <b><span style="font-weight:bold;">De:</span></b> Marco
Hugentobler <a rel="nofollow" shape="rect" class="yiv6843595713moz-txt-link-rfc2396E" ymailto="mailto:marco.hugentobler@sourcepole.ch" target="_blank" href="mailto:marco.hugentobler@sourcepole.ch"><marco.hugentobler@sourcepole.ch></a><br clear="none">
<b><span style="font-weight:bold;">Para:</span></b>
<a rel="nofollow" shape="rect" class="yiv6843595713moz-txt-link-abbreviated" ymailto="mailto:qgis-developer@lists.osgeo.org" target="_blank" href="mailto:qgis-developer@lists.osgeo.org">qgis-developer@lists.osgeo.org</a> <br clear="none">
<b><span style="font-weight:bold;">Enviado:</span></b>
Lunes 4 de noviembre de 2013 11:37<br clear="none">
<b><span style="font-weight:bold;">Asunto:</span></b>
Re: [Qgis-developer] how to know if QPainter comes
from a print job ?<br clear="none">
</font> </div>
<div class="yiv6843595713y_msg_container" id="yiv6843595713yui_3_13_0_1_1383579702577_3009"><br clear="none">
<div id="yiv6843595713">
<div id="yiv6843595713yui_3_13_0_1_1383579702577_3011">
<div class="yiv6843595713moz-cite-prefix" id="yiv6843595713yui_3_13_0_1_1383579702577_3010">Hi <br clear="none">
<br clear="none">
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.<br clear="none">
<br clear="none">
Regards,<br clear="none">
Marco<br clear="none">
<br clear="none">
On 04.11.2013 11:28, A Huarte wrote:<br clear="none">
</div>
<blockquote type="cite">
<div class="yiv6843595713yqt3386251864" id="yiv6843595713yqt99291">
<div class="yiv6843595713yui_3_13_0_1_1383579702577_2754" style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;">
<div>Hi!</div>
<div><br clear="none">
</div>
<div class="yiv6843595713yui_3_13_0_1_1383579702577_2755" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;">Within of qgis_core I
need know if a QgsRenderContext comes from a
print job (from composer) in order to
disable one functionality.</div>
<div><br clear="none">
</div>
<div style="background-color:transparent;">I
get that information from QPainter,
QPaintDevice, QPaintEngine::Type ?<br clear="none">
</div>
<div class="yiv6843595713yui_3_13_0_1_1383579702577_2757" style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal;"><br clear="none">
</div>
<div class="yiv6843595713yui_3_13_0_1_1383579702577_2758" style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal;">Thank your
very much!</div>
<div class="yiv6843595713yui_3_13_0_1_1383579702577_2759" style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal;"><br clear="none">
</div>
</div>
</div>
<br clear="none">
<fieldset class="yiv6843595713mimeAttachmentHeader"></fieldset>
<br clear="none">
<pre>_______________________________________________
Qgis-developer mailing list
<a rel="nofollow" shape="rect" class="yiv6843595713moz-txt-link-abbreviated" ymailto="mailto:Qgis-developer@lists.osgeo.org" target="_blank" href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a>
<a rel="nofollow" shape="rect" class="yiv6843595713moz-txt-link-freetext" target="_blank" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a></pre>
</blockquote>
<br clear="none">
<br clear="none">
<pre class="yiv6843595713moz-signature">--
Dr. Marco Hugentobler
Sourcepole - Linux & Open Source Solutions
Weberstrasse 5, CH-8004 Zürich, Switzerland
<a rel="nofollow" shape="rect" class="yiv6843595713moz-txt-link-abbreviated" ymailto="mailto:marco.hugentobler@sourcepole.ch" target="_blank" href="mailto:marco.hugentobler@sourcepole.ch">marco.hugentobler@sourcepole.ch</a> <a rel="nofollow" shape="rect" class="yiv6843595713moz-txt-link-freetext" target="_blank" href="http://www.sourcepole.ch/">http://www.sourcepole.ch</a>
Technical Advisor QGIS Project Steering Committee </pre>
</div>
</div>
<br clear="none">
<div class="yiv6843595713yqt3386251864" id="yiv6843595713yqt69454">_______________________________________________<br clear="none">
Qgis-developer mailing list<br clear="none">
<a rel="nofollow" shape="rect" ymailto="mailto:Qgis-developer@lists.osgeo.org" target="_blank" href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br clear="none">
<a rel="nofollow" shape="rect" target="_blank" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a></div>
<br clear="none">
<br clear="none">
</div>
</div>
</div>
</blockquote>
</div></div>
<br clear="none">
<fieldset class="yiv6843595713mimeAttachmentHeader"></fieldset>
<br clear="none">
<pre>_______________________________________________
Qgis-developer mailing list
<a rel="nofollow" shape="rect" class="yiv6843595713moz-txt-link-abbreviated" ymailto="mailto:Qgis-developer@lists.osgeo.org" target="_blank" href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a>
<a rel="nofollow" shape="rect" class="yiv6843595713moz-txt-link-freetext" target="_blank" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a></pre>
</blockquote>
<br clear="none">
<br clear="none">
<pre class="yiv6843595713moz-signature">--
Dr. Marco Hugentobler
Sourcepole - Linux & Open Source Solutions
Weberstrasse 5, CH-8004 Zürich, Switzerland
<a rel="nofollow" shape="rect" class="yiv6843595713moz-txt-link-abbreviated" ymailto="mailto:marco.hugentobler@sourcepole.ch" target="_blank" href="mailto:marco.hugentobler@sourcepole.ch">marco.hugentobler@sourcepole.ch</a> <a rel="nofollow" shape="rect" class="yiv6843595713moz-txt-link-freetext" target="_blank" href="http://www.sourcepole.ch/">http://www.sourcepole.ch</a>
Technical Advisor QGIS Project Steering Committee </pre>
</div></div><br clear="none"><div class="yiv6843595713yqt1497702274" id="yiv6843595713yqt07438">_______________________________________________<br clear="none">Qgis-developer mailing list<br clear="none"><a rel="nofollow" shape="rect" ymailto="mailto:Qgis-developer@lists.osgeo.org" target="_blank" href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br clear="none"><a rel="nofollow" shape="rect" target="_blank" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a></div><br clear="none"><br clear="none"></div></div> </div> </div> </blockquote><div></div> </div></div></div></div></body></html>