[Qgis-developer] Raster scale bar in Legend

Tim Sutton lists at linfiniti.com
Mon Oct 18 03:25:55 EDT 2010


On Wed, 2010-08-11 at 12:02 +0200, Benoit de Cabissole wrote:
> Hi all,
> 
> Is it possible to change the "scale bar" (horizontal multicolour or grey
> bar) displayed below the raster icon in the Legend pane using python? Can
> that scale bar have arbitrary dimensions, e.g. grows or retracts like the
> legend of a vector layer?
> 
> I'm trying to find a reference to it in the API doc but I do not really know
> what to look for: legend, icon, symbology, ...?
> 

Its managed in two places:

QgsRasterLayer and QgsLegendLayer:

void QgsLegendLayer::rasterLayerSymbology( QgsRasterLayer* layer )
{
  SymbologyList itemList;
  QPixmap legendpixmap = layer->legendAsPixmap( true ).scaled( 20, 20,
Qt::KeepAspectRatio );
  itemList.append( qMakePair( QString(), legendpixmap ) );

  changeSymbologySettings( layer, itemList );
}

I dont see any way to tweak this from python api though. Python users
please correct me if I missed something....

Regards

Tim


> Has someone do it before?
> 
> Cheers,
> Benoit
> 
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
Url : http://lists.osgeo.org/pipermail/qgis-developer/attachments/20101018/b6bbf160/attachment.bin


More information about the Qgis-developer mailing list