[Qgis-developer] Add Layer to overview

Germán Carrillo carrillo.german at gmail.com
Wed Sep 23 11:33:38 EDT 2009


Well, the 'actionAddToOverview' method from QgisInterface do work, just add
this line to your code:

      self.iface.actionAddToOverview().activate( 0 ) # '0' is the signal to
emit, in this case "QAction.triggered()"

And this way you activate the AddToOverview action from QGis. It adds the
active layer to overview map. So, you don't need the workaround.

Regards.

Germán

El 22 de septiembre de 2009 11:38, Germán Carrillo <
carrillo.german at gmail.com> escribió:

> Hi Michele.
>
> It seems the 'actionAddToOverview' method doesn't work yet. As a
> workaround, you could do something like this:
>
>       layer = self.iface.activeLayer()
>       mapCanvasLayer = QgsMapCanvasLayer( layer )
>       mapCanvasLayer.setInOverview( True )
>       self.iface.mapCanvas().setLayerSet( [ mapCanvasLayer ] )
>
> Regards.
>
> Germán
>
> El 22 de septiembre de 2009 09:40, Michele Mammini <mamminim at yahoo.it>escribió:
>
>  Hi Germán
>>
>> may you write me how to write the code in my plugin in order to use this
>> method?
>> Maybe I understood that I have to use the class QAction() but i don't
>> understand how to use it.
>>
>> Thank you
>>
>> Michele.
>>
>>
>> At 16.19 21/09/2009, you wrote:
>>
>> Hi Michele.
>>
>> There is an 'actionAddToOverview' method in QgisInterface class [1], so
>> you could use it directly for your plugin.
>>
>> Regards,
>>
>> Germán
>>
>> ---------------------------
>> [1] http://doc.qgis.org/head/classQgisInterface.html
>>
>>
>> 2009/9/21 Michele Mammini <mamminim at yahoo.it>
>>  Dear all,
>>
>> i'm new on QGis, and i'm starting to develop plugin for my project using
>> Python and QT.
>> I'm able to connect to PostGIS database to query the data and to load the
>> Layer into QGis, but i'm not able to load the same layer in the Overview
>> windows.
>> May someone can suggest me which function/class/code allow me to do it?
>>
>> Thank you,
>>
>> Michele.
>>
>> _______________________________________________
>> Qgis-developer mailing list
>>  Qgis-developer at lists.osgeo.org
>>  http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>>
>> --
>> -----------
>>   |\__
>> (:>__)(
>>   |/
>>
>> Soluciones Geoinformáticas Libres
>> http://geotux.tuxfamily.org/
>>
>>
>>  ______________________________________________________________________
>> *Michele Mammini
>> *Via dell'Arno, 54 - San Benedetto
>> 56021
>> Cascina (PISA)
>>
>> Tel*:             +39 050 747037
>> *Cell*:            +39 328 9039640
>>
>> *email:  * mamminim at yahoo.it* <mamminim at yahoo.it>
>> Skype:  *mamminim
>> * _____________________________________________________________________
>>
> --
> -----------
>   |\__
> (:>__)(
>   |/
>
>
> Soluciones Geoinformáticas Libres
> http://geotux.tuxfamily.org/
>
> --
-----------
  |\__
(:>__)(
  |/

Soluciones Geoinformáticas Libres
http://geotux.tuxfamily.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20090923/2773cf8c/attachment.html


More information about the Qgis-developer mailing list