[Qgis-developer] enabling the overview map
Larry Shaffer
larrys at dakotacarto.com
Thu Apr 5 00:47:24 EDT 2012
Hi Aaron,
On Wed, Apr 4, 2012 at 5:27 PM, SJWC GIS <> wrote:
> Hello, I'm creating a plugin that modifies the qgis interface defaults
> when it's installed. One of the things I'm trying to do is turn on the
> overview map by default. I haven't found a way to do it yet. I could only
> get as close as...
>
> self.iface.mapCanvas().enableOverviewMode(QgsMapOverviewCanvas(None,
> self.iface.mapCanvas()))
>
> This ends up crashing qgis altogether. I'm guessing it has something to
> do with the fact that I have no reference to the existing overview map
> object, and trying to create a new one is bad news. Any insight you could
> provide on the best way to accomplish such things (and where in the api I
> can look for answers like this) would be much appreciated. Thanks!
>
I think the overview object is already created on project load (if the
project has one).
If you are looking to just show/hide it's dock widget, try...
overview = iface.mainWindow().findChild(QDockWidget, "Overview")
if overview:
overview.show() # or hide(), etc.
Regards,
Larry Shaffer
Dakota Cartography
Black Hills, South Dakota
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20120404/d0cfba18/attachment.html
More information about the Qgis-developer
mailing list