[Qgis-developer] setting QgsMapCanvas size, for testing map tools
Martin Dobias
wonder.sk at gmail.com
Fri Jul 1 09:52:18 PDT 2016
Hi Tom
On Fri, Jul 1, 2016 at 5:25 PM, Tom Chadwin <tom.chadwin at nnpa.org.uk> wrote:
> Hi Martin
>
>
> Martin Dobias wrote
>>>>> iface.mapCanvas().geometry()
>> PyQt4.QtCore.QRect(0, 0, 879, 390)
>>>>> iface.mapCanvas().viewport().geometry()
>> PyQt4.QtCore.QRect(3, 3, 873, 384)
>
> Ah, OK! I didn't know anything about a canvas frame. So, without doing
> setFrameStyle(), does canvas.extent() give canvas.geometry() or
> canvas.viewport().geometry()?
With the frame, canvas.extent() is linked to size reported by
cavas.viewport().geometry().
Even better is to use canvas.mapSettings().outputSize() that gives you
the actual image size used for rendering (although it should be the
same as the size from canvas.viewport().geometry()).
Cheers
Martin
More information about the Qgis-developer
mailing list