Hi Chris

On Sun, Jan 27, 2013 at 8:41 PM, Chris Crook <[email protected]> wrote:
> I'm updating a plugin to use a plugin layer to display a scale box, and I 
> have a problem with labelling from other layers appearing on top of my plugin 
> layer.
>
>
> I'm using a plugin layer so that the scale box will appear on the map when it 
> is printed.  It basically draws a filled rectangle and puts some text in it.  
> The problem I have is that labelling from layers underneath the scale box 
> layer end up plotting on top of it.
>
> Is there a simple way of ensuring that the box appears on top of the 
> labelling.  I'm wondering about drawing the rectangle as a label itself with 
> some sort of custom labelling, but that looks like a lot more work :-(

I think you have these options:
- hook to QgsMapCanvas::renderComplete(QPainter*) signal and draw the
scale box in your slot
- implement a QgsMapCanvasItem that would render scale bar

By the way, there is already scale bar functionality (used to be a
plugin, now in menu View > Decorations > Scale Bar). The logic is in
QgsDecorationScaleBar class (in src/app/ dir).

Regards
Martin
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to