[Qgis-developer] setting QgsMapCanvas size, for testing map tools

Richard Duivenvoorde rdmailings at duif.net
Wed Jun 29 07:44:29 PDT 2016


On 29-06-16 16:37, Sandro Santilli wrote:
> I'm writing a testcase for bug 13952 [1] and would need a
> way to set the map canvas size so to be able to syntetize
> clicks on pixels with predictable contents. How can it be
> done ?
> 
> Beside, I've found an QgsMapCanvas::updateMapSize() method
> which is declared in the header but never defined (git blame
> says it's yours, Nathan).
> 
> I'm thinking there could be enough similar testcases to
> justify a service class to simplify writing them. What
> do you think ?

Hi Sandro,

I once was asked to define a mapcanvas with a certain size, and tried it
in python, see:

https://github.com/rduivenvoorde/simplesvg/blob/master/src/simplesvg/mapsizer/MapSizerDialog.py#L93

the hard part (I think) is that the exact size of the mapcanvas was
defined relative to other (parent) widgets, and for example depending on
the OS....

would be cool though to be able to just SET it, given that is the most
important widget in QGIS...

Regards,

Richard



More information about the Qgis-developer mailing list