mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-11-04 00:04:25 -05:00 
			
		
		
		
	Add QgsIconUtils::iconForLayerType
This commit is contained in:
		
							parent
							
								
									4dc659c535
								
							
						
					
					
						commit
						a51a9c4854
					
				@ -75,6 +75,13 @@ Returns an icon representing point cloud layers.
 | 
			
		||||
    static QIcon iconForLayer( const QgsMapLayer *layer );
 | 
			
		||||
%Docstring
 | 
			
		||||
Returns the icon corresponding to a specified map ``layer``.
 | 
			
		||||
%End
 | 
			
		||||
 | 
			
		||||
    static QIcon iconForLayerType( QgsMapLayerType type );
 | 
			
		||||
%Docstring
 | 
			
		||||
Returns the default icon for the specified layer ``type``.
 | 
			
		||||
 | 
			
		||||
.. versionadded:: 3.22
 | 
			
		||||
%End
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -91,23 +91,13 @@ QIcon QgsIconUtils::iconForLayer( const QgsMapLayer *layer )
 | 
			
		||||
  switch ( layer->type() )
 | 
			
		||||
  {
 | 
			
		||||
    case QgsMapLayerType::RasterLayer:
 | 
			
		||||
    {
 | 
			
		||||
      return QgsIconUtils::iconRaster();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    case QgsMapLayerType::MeshLayer:
 | 
			
		||||
    {
 | 
			
		||||
      return QgsIconUtils::iconMesh();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    case QgsMapLayerType::VectorTileLayer:
 | 
			
		||||
    {
 | 
			
		||||
      return QgsIconUtils::iconVectorTile();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    case QgsMapLayerType::PointCloudLayer:
 | 
			
		||||
    case QgsMapLayerType::PluginLayer:
 | 
			
		||||
    case QgsMapLayerType::AnnotationLayer:
 | 
			
		||||
    {
 | 
			
		||||
      return QgsIconUtils::iconPointCloud();
 | 
			
		||||
      return QgsIconUtils::iconForLayerType( layer->type() );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    case QgsMapLayerType::VectorLayer:
 | 
			
		||||
@ -142,11 +132,33 @@ QIcon QgsIconUtils::iconForLayer( const QgsMapLayer *layer )
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    default:
 | 
			
		||||
    {
 | 
			
		||||
      return QIcon();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return QIcon();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QIcon QgsIconUtils::iconForLayerType( QgsMapLayerType type )
 | 
			
		||||
{
 | 
			
		||||
  switch ( type )
 | 
			
		||||
  {
 | 
			
		||||
    case QgsMapLayerType::RasterLayer:
 | 
			
		||||
      return QgsIconUtils::iconRaster();
 | 
			
		||||
 | 
			
		||||
    case QgsMapLayerType::MeshLayer:
 | 
			
		||||
      return QgsIconUtils::iconMesh();
 | 
			
		||||
 | 
			
		||||
    case QgsMapLayerType::VectorTileLayer:
 | 
			
		||||
      return QgsIconUtils::iconVectorTile();
 | 
			
		||||
 | 
			
		||||
    case QgsMapLayerType::PointCloudLayer:
 | 
			
		||||
      return QgsIconUtils::iconPointCloud();
 | 
			
		||||
 | 
			
		||||
    case QgsMapLayerType::VectorLayer:
 | 
			
		||||
      return QgsIconUtils::iconPolygon();
 | 
			
		||||
 | 
			
		||||
    case QgsMapLayerType::PluginLayer:
 | 
			
		||||
    case QgsMapLayerType::AnnotationLayer:
 | 
			
		||||
      break;
 | 
			
		||||
  }
 | 
			
		||||
  return QIcon();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -90,6 +90,13 @@ class CORE_EXPORT QgsIconUtils
 | 
			
		||||
     */
 | 
			
		||||
    static QIcon iconForLayer( const QgsMapLayer *layer );
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the default icon for the specified layer \a type.
 | 
			
		||||
     *
 | 
			
		||||
     * \since QGIS 3.22
 | 
			
		||||
     */
 | 
			
		||||
    static QIcon iconForLayerType( QgsMapLayerType type );
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // QGSICONUTILS_H
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user