Skip to content

Commit

Permalink
Identify tool: Show layer type icons in layer selection mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed May 21, 2013
1 parent e5d8307 commit 29871ee
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/app/qgsmaptoolidentifyaction.cpp
Expand Up @@ -13,6 +13,7 @@
* *
***************************************************************************/

#include "qgsapplication.h"
#include "qgscursors.h"
#include "qgsdistancearea.h"
#include "qgsfeature.h"
Expand Down Expand Up @@ -251,6 +252,29 @@ void QgsMapToolIdentifyAction::fillLayerSelectionMenu( QMenu& menu )
{
QAction* action = new QAction( resultIt.key()->name(), 0 );
action->setData( resultIt.key()->id() );
//add point/line/polygon icon
QgsVectorLayer* vl = qobject_cast<QgsVectorLayer*>( resultIt.key() );
if ( vl )
{
switch ( vl->geometryType() )
{
case QGis::Point:
action->setIcon( QgsApplication::getThemeIcon( "/mIconPointLayer.png" ) );
break;
case QGis::Line:
action->setIcon( QgsApplication::getThemeIcon( "/mIconLineLayer.png" ) );
break;
case QGis::Polygon:
action->setIcon( QgsApplication::getThemeIcon( "/mIconPolygonLayer.png" ) );
break;
default:
break;
}
}
else if ( resultIt.key()->type() == QgsMapLayer::RasterLayer )
{
action->setIcon( QgsApplication::getThemeIcon( "/mIconRaster.png" ) );
}
QObject::connect( action, SIGNAL( hovered() ), this, SLOT( handleMenuHover() ) );
menu.addAction( action );
}
Expand Down

0 comments on commit 29871ee

Please sign in to comment.