[Qgis-developer] Raster scale bar in Legend

Benoit de Cabissole benoit at exigesa.com
Mon Oct 18 03:41:26 EDT 2010


 Hi again Tim,

Thanks for your reply.
It seems that what you are describing is the small thumbnail icon of the
raster, isn't it?

What I'm really looking for is a way to change the small colour scale
bar below the thumbnail to display a full colour scale bar with numbers
(as created with the 'colour scale bar' plugin for example). So far
absolutely no luck in Python...

Cheers,
Benoit



On 18/10/2010 09:25, Tim Sutton wrote:
> 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


More information about the Qgis-developer mailing list