<p>Hi<br>
On Sep 19, 2012 5:33 PM, "DanielK" <<a href="mailto:daniel.klich@gmx.de">daniel.klich@gmx.de</a>> wrote:<br>
><br>
> Tim Sutton-4 wrote<br>
> >> I load a raster layer, set canvas color and so on. But the layer only<br>
> >> displays if i use QgsMapLayerRegistry.instance().addMapLayer(self.layer).<br>
> >> Without these code line my plugin only displays the rubber band, but not<br>
> >> the<br>
> >> raster layer. But if i use ...addMapLayer() it also loads the layer in<br>
> >> QGIS.<br>
> >> I want to have a behaviour like in the GDAL - Georeferenzierung plugin.<br>
> >> There you could add a raster layer and the plugin displays it only in the<br>
> >> plugin window, not in the QGIS MainWindow.<br>
> >><br>
> ><br>
> > Try passing False to QgsMapLayerRegistry.instance().addMapLayer(<br>
> > <layer><br>
> > , [bool])<br>
> ><br>
> > The bool options should suppress it being added to the main canvas.<br>
> ><br>
> > Then manually add it to the map canvas by wrapping it as a<br>
> > mapcanvaslayer and explicitly passing a set of mapcanvaslayers using<br>
> > QgsMapCanvas.setLayerSet()<br>
><br>
> Thank you. That worked for me. (<br>
> QgsMapLayerRegistry.instance().addMapLayer(self.layer, False) )<br>
><br>
><br>
> Tim Sutton-4 wrote<br>
> > PS QgsMapLayerRegistry.instance().addMapLayer(<br>
> > <layer><br>
> > , [bool]) is<br>
> > deprecated, use addMapLayers(<br>
> > <list><br>
> > , bool) rather.<br>
><br>
> I am using Version 1.7.4. addMapLayers(<list>, bool) only works in 1.8.,<br>
> right ?<br>
></p>
<p>Correct. <br></p>
<p>Regards</p>
<p>Tim </p>
<p>> best regards,<br>
><br>
> Daniel<br>
><br>
><br>
><br>
><br>
> --<br>
> View this message in context: <a href="http://osgeo-org.1560.n6.nabble.com/Display-raster-layer-on-own-Map-Canvas-tp5002935p5002986.html">http://osgeo-org.1560.n6.nabble.com/Display-raster-layer-on-own-Map-Canvas-tp5002935p5002986.html</a><br>
> Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.<br>
> _______________________________________________<br>
> Qgis-developer mailing list<br>
> <a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</p>