[Qgis-developer] setting QgsMapCanvas size, for testing map tools
Barry Rowlingson
b.rowlingson at lancaster.ac.uk
Thu Jun 30 14:14:34 PDT 2016
Maybe I've missed something here, but doesn't the canvas resize method
set the canvas pixel size? This behaves as expected when run
standalone from a python prompt.
from qgis.core import *
from qgis.gui import *
app = QgsApplication([],True)
canvas = QgsMapCanvas()
canvas.show()
canvas.resize(1000,200)
canvas.resize(1000,1000)
Note the map canvas has no parent, so just appears on its own at the
specified size.
Or maybe I've missed a point....
On Thu, Jun 30, 2016 at 8:49 PM, Sandro Santilli <strk at kbt.io> wrote:
> On Thu, Jun 30, 2016 at 03:24:12AM -0700, Tom Chadwin wrote:
>> I asked about this a while back, as I could not get a defined canvas size in
>> my tests. I never found an answer, but never understood why it didn't work:
>>
>> https://lists.osgeo.org/pipermail/qgis-developer/2015-November/040392.html
>
> Yeah, I feel your pain. It's a frustrating situation indeed.
> We'd need an helper class for testcases, to make things like
> setting the canvas size easy, and to simulate user events
> like mouse moves and clicks, tools selection and the like.
>
>
> --strk;
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
More information about the Qgis-developer
mailing list