Skip to content

Commit

Permalink
Remove duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 6, 2021
1 parent 77729d1 commit 13b6cbc
Showing 1 changed file with 1 addition and 48 deletions.
49 changes: 1 addition & 48 deletions src/core/layertree/qgslayertreemodel.cpp
Expand Up @@ -199,54 +199,7 @@ QVariant QgsLayerTreeModel::data( const QModelIndex &index, int role ) const
return QVariant();

// icons possibly overriding default icon
QIcon icon;

switch ( layer->type() )
{
case QgsMapLayerType::RasterLayer:
icon = QgsIconUtils::iconRaster();
break;

case QgsMapLayerType::MeshLayer:
icon = QgsIconUtils::iconMesh();
break;

case QgsMapLayerType::VectorTileLayer:
icon = QgsIconUtils::iconVectorTile();
break;

case QgsMapLayerType::PointCloudLayer:
icon = QgsIconUtils::iconPointCloud();
break;

case QgsMapLayerType::VectorLayer:
{
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer );
switch ( vlayer->geometryType() )
{
case QgsWkbTypes::PointGeometry:
icon = QgsIconUtils::iconPoint();
break;
case QgsWkbTypes::LineGeometry:
icon = QgsIconUtils::iconLine();
break;
case QgsWkbTypes::PolygonGeometry:
icon = QgsIconUtils::iconPolygon();
break;
case QgsWkbTypes::UnknownGeometry:
icon = QgsIconUtils::iconGeometryCollection();
break;
case QgsWkbTypes::NullGeometry:
icon = QgsIconUtils::iconTable();
break;
}
break;
}

case QgsMapLayerType::PluginLayer:
case QgsMapLayerType::AnnotationLayer:
break;
}
QIcon icon = QgsIconUtils::iconForLayer( layer );

// if there's just on legend entry that should be embedded in layer - do that!
if ( testFlag( ShowLegend ) && legendEmbeddedInParent( nodeLayer ) )
Expand Down

0 comments on commit 13b6cbc

Please sign in to comment.