Skip to content
Permalink
Browse files

show classification attribute above the classes in legend

git-svn-id: http://svn.osgeo.org/qgis/trunk@12587 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Dec 22, 2009
1 parent 69bb75f commit 457b180afbe4ca973431c6468489bd44d98ba34e
Showing with 20 additions and 21 deletions.
  1. +20 −21 src/app/legend/qgslegendlayer.cpp
@@ -216,6 +216,26 @@ void QgsLegendLayer::vectorLayerSymbology( const QgsVectorLayer* layer, double w
const QgsRenderer* renderer = layer->renderer();
const QList<QgsSymbol*> sym = renderer->symbols();

//create an item for each classification field (only one for most renderers)
QSettings settings;
if ( settings.value( "/qgis/showLegendClassifiers", false ).toBool() )
{
if ( renderer->needsAttributes() )
{
QgsAttributeList classfieldlist = renderer->classificationAttributes();
const QgsFieldMap& fields = layer->pendingFields();
for ( QgsAttributeList::iterator it = classfieldlist.begin(); it != classfieldlist.end(); ++it )
{
QString classfieldname = layer->attributeAlias( *it );
if ( classfieldname.isEmpty() )
{
classfieldname = fields[*it].name();
}
itemList.append( qMakePair( classfieldname, QPixmap() ) );
}
}
}

for ( QList<QgsSymbol*>::const_iterator it = sym.begin(); it != sym.end(); ++it )
{
QImage img;
@@ -255,27 +275,6 @@ void QgsLegendLayer::vectorLayerSymbology( const QgsVectorLayer* layer, double w
itemList.append( qMakePair( values, pix ) );
}


//create an item for each classification field (only one for most renderers)
QSettings settings;
if ( settings.value( "/qgis/showLegendClassifiers", false ).toBool() )
{
if ( renderer->needsAttributes() )
{
QgsAttributeList classfieldlist = renderer->classificationAttributes();
const QgsFieldMap& fields = layer->pendingFields();
for ( QgsAttributeList::iterator it = classfieldlist.begin(); it != classfieldlist.end(); ++it )
{
QString classfieldname = layer->attributeAlias( *it );
if ( classfieldname.isEmpty() )
{
classfieldname = fields[*it].name();
}
itemList.append( qMakePair( classfieldname, QPixmap() ) );
}
}
}

changeSymbologySettings( layer, itemList );
}

0 comments on commit 457b180

Please sign in to comment.
You can’t perform that action at this time.