I think if <span style>QgsPluginLayer is a usable option that would be the way to go, or maybe </span>
<span style>QgsVectorLayer</span>  but I suspect that you will need a provider for that. <div><br></div><div>I think having it show up in the legend is a good idea that way it can be turned on and off, styled, and ordered as the user needs.  E.g. sometimes I might like to have yellow grid lines rather then black.</div>

<div><br></div><div>- Nathan<br><br><div class="gmail_quote">On Thu, May 10, 2012 at 10:01 PM, Etienne Tourigny <span dir="ltr">&lt;<a href="mailto:etourigny.dev@gmail.com" target="_blank">etourigny.dev@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Thu, May 10, 2012 at 1:35 AM, Alister  Hood<br>
&lt;<a href="mailto:Alister.Hood@synergine.com">Alister.Hood@synergine.com</a>&gt; wrote:<br>
&gt;&gt; Date: Wed, 9 May 2012 18:00:07 -0300<br>
&gt;&gt; From: Etienne Tourigny &lt;<a href="mailto:etourigny.dev@gmail.com">etourigny.dev@gmail.com</a>&gt;<br>
&gt;&gt; Subject: [Qgis-developer] show grid on map canvas (similiar to grid<br>
&gt;&gt;         used in composer) - strategy?<br>
&gt;&gt; To: qgis-developer &lt;<a href="mailto:qgis-developer@lists.osgeo.org">qgis-developer@lists.osgeo.org</a>&gt;<br>
&gt;&gt; Message-ID:<br>
&gt;&gt;         &lt;<a href="mailto:CA%2BTxYvPd-5VHoyCX4UHio9X416hKx9ZGeQ5EnnnQVaDP0L9ZCg@mail.gmail.com">CA+TxYvPd-5VHoyCX4UHio9X416hKx9ZGeQ5EnnnQVaDP0L9ZCg@mail.gmail.com</a>&gt;<br>
&gt;&gt; Content-Type: text/plain; charset=ISO-8859-1<br>
&gt;&gt;<br>
&gt;&gt; Hi all,<br>
&gt;&gt;<br>
&gt;&gt; I would like to add support to draw a grid on the map canvas, in a way<br>
&gt;&gt; similar to what is done in the map composer (although perhaps without<br>
&gt;&gt; the annotations on the borders).<br>
&gt;&gt;<br>
&gt;&gt; What should be the approach used?<br>
&gt;&gt;<br>
&gt;&gt; 1) plugin or core?<br>
&gt;&gt; 2) rubberbands or basic plot functions triggered after mapCanvas update?<br>
&gt;&gt;<br>
&gt;&gt; I think both drawing strategies are possible using a plugin.<br>
&gt;&gt;<br>
&gt;&gt; It would be best to write in the core, assuming there is sufficient<br>
&gt;&gt; interest in this, but it will take time to trickle down to the stable<br>
&gt;&gt; version (an argument for making it a plugin).<br>
&gt;&gt;<br>
&gt;&gt; I know the current workaround is to create a vector grid with ftools,<br>
&gt;&gt; but that is a little clunky.<br>
&gt;&gt;<br>
&gt;&gt; Any thoughts?<br>
&gt;&gt; Etienne<br>
&gt;<br>
&gt; Hi,<br>
&gt; I&#39;m not a developer, so this might be a crazy and unnecessary idea, but would it be feasible to create a graticule _provider_?<br>
&gt;<br>
&gt; This approach would mean that like grids created with ftools, the grid would be created as a layer, but it wouldn&#39;t be file based and its extents would automatically update.<br>
&gt;<br>
&gt; Unlike the approach used in the composer, this would mean:<br>
&gt; - digitising tools could snap to the grid lines.<br>
&gt; - the identify tool could identify the grid lines.<br>
&gt; - the layer could be used for analysis (e.g. you might want to use it to split vector layers).<br>
&gt; - symbology and feature labelling could work just like other vector layers.<br>
<br>
</div></div>Those are pretty cool ideas!<br>
Perhaps a new QgsMapCanvasItem, rather than a provider? Or even a new<br>
QgsPluginLayer or QgsVectorLayer, so this is actually a layer? In this<br>
case the layer would have to be in the legend, whereas it might be<br>
better to hide it from the legend.<br>
<div class="im"><br>
&gt;<br>
&gt; If this was to actually replace the grids in the composer, some improvements to feature labelling would be needed.  Some of these would probably be good to have anyway, e.g. an option to label both ends of a line, and an option to align labels horizontally or vertically on the page, rather than N-S or E-W.  I guess the difficult one would be providing a way to display labels outside the map frame...<br>


<br>
</div>This kind of modification would require modifying the core rather than<br>
making a plugin I think.<br>
<br>
&gt;<br>
&gt; Regards,<br>
&gt; Alister<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<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" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</div></div></blockquote></div><br></div>