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

Sandro Santilli strk at kbt.io
Fri Jul 1 09:07:54 PDT 2016


On Fri, Jul 01, 2016 at 05:58:57PM +0200, Sandro Santilli wrote:
> On Thu, Jun 30, 2016 at 10:14:34PM +0100, Barry Rowlingson wrote:
> > 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.
> 
> It does ! Thanks for the pointer.

Still, my problem is the following:

  QgsMapCanvas *mCanvas = new QgsMapCanvas();
  mCanvas->resize( QSize(50, 50) );
  mCanvas->setExtent( QgsRectangle( 0, 0, 50, 50 ) );
  QCOMPARE( mCanvas->scale(), 1.0 ); //<-- fails, returning 3.1631e+07

--strk;


More information about the Qgis-developer mailing list