Skip to content

Commit 29871ee

Browse files
committed
Identify tool: Show layer type icons in layer selection mode
1 parent e5d8307 commit 29871ee

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/app/qgsmaptoolidentifyaction.cpp

+24
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* *
1414
***************************************************************************/
1515

16+
#include "qgsapplication.h"
1617
#include "qgscursors.h"
1718
#include "qgsdistancearea.h"
1819
#include "qgsfeature.h"
@@ -251,6 +252,29 @@ void QgsMapToolIdentifyAction::fillLayerSelectionMenu( QMenu& menu )
251252
{
252253
QAction* action = new QAction( resultIt.key()->name(), 0 );
253254
action->setData( resultIt.key()->id() );
255+
//add point/line/polygon icon
256+
QgsVectorLayer* vl = qobject_cast<QgsVectorLayer*>( resultIt.key() );
257+
if ( vl )
258+
{
259+
switch ( vl->geometryType() )
260+
{
261+
case QGis::Point:
262+
action->setIcon( QgsApplication::getThemeIcon( "/mIconPointLayer.png" ) );
263+
break;
264+
case QGis::Line:
265+
action->setIcon( QgsApplication::getThemeIcon( "/mIconLineLayer.png" ) );
266+
break;
267+
case QGis::Polygon:
268+
action->setIcon( QgsApplication::getThemeIcon( "/mIconPolygonLayer.png" ) );
269+
break;
270+
default:
271+
break;
272+
}
273+
}
274+
else if ( resultIt.key()->type() == QgsMapLayer::RasterLayer )
275+
{
276+
action->setIcon( QgsApplication::getThemeIcon( "/mIconRaster.png" ) );
277+
}
254278
QObject::connect( action, SIGNAL( hovered() ), this, SLOT( handleMenuHover() ) );
255279
menu.addAction( action );
256280
}

0 commit comments

Comments
 (0)