30using namespace Qt::StringLiterals;
115 switch ( layer->
type() )
129 if (
const QgsPluginLayer *pl = qobject_cast<const QgsPluginLayer *>( layer ) )
131 const QIcon icon = pl->icon();
132 if ( !icon.isNull() )
140 const QgsVectorLayer *vl = qobject_cast<const QgsVectorLayer *>( layer );
212 size = icon.actualSize( size );
213 const qreal dpr = icon.pixmap( size ).devicePixelRatio();
217 const QIcon overlayIcon( overlayPath );
219 QPixmap pixmap( size * dpr );
220 pixmap.setDevicePixelRatio( dpr );
221 pixmap.fill( Qt::transparent );
223 QPainter painter( &pixmap );
224 painter.drawPixmap( 0, 0, icon.pixmap( size, dpr ) );
225 painter.drawPixmap( 0, 0, overlayIcon.pixmap( size, dpr ) );
228 return QIcon( pixmap );
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
LayerType
Types of layers that can be added to a map.
@ Group
Composite group layer. Added in QGIS 3.24.
@ Plugin
Plugin based layer.
@ TiledScene
Tiled scene layer. Added in QGIS 3.34.
@ Annotation
Contains freeform, georeferenced annotations. Added in QGIS 3.16.
@ VectorTile
Vector tile layer. Added in QGIS 3.14.
@ Mesh
Mesh layer. Added in QGIS 3.2.
@ PointCloud
Point cloud layer. Added in QGIS 3.18.
WkbType
The WKB type describes the number of dimensions a geometry has.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
static QIcon iconForLayerType(Qgis::LayerType type)
Returns the default icon for the specified layer type.
static QIcon addOverlay(const QIcon &icon, const QString &overlayPath, QSize size=QSize(16, 16))
Returns a copy of icon with an overlay icon rendered from the image file at overlayPath.
static QIcon iconLine()
Returns an icon representing line geometries.
static QIcon iconPolygon()
Returns an icon representing polygon geometries.
static QIcon iconTiledScene()
Returns an icon representing tiled scene layers.
static QIcon iconForWkbType(Qgis::WkbType type)
Returns the icon for a vector layer whose geometry type is provided.
static QIcon iconGeometryCollection()
Returns an icon representing geometry collections.
static QIcon iconDefaultLayer()
Returns a default icon for layers, which aren't the standard raster/vector/... types.
static QIcon iconPointCloud()
Returns an icon representing point cloud layers.
static QIcon iconForGeometryType(Qgis::GeometryType typeGroup)
Returns the icon for a vector layer whose geometry typeGroup is provided.
static QIcon iconPoint()
Returns an icon representing point geometries.
static QIcon iconTable()
Returns an icon representing non-spatial layers (tables).
static QIcon iconRaster()
Returns an icon representing raster layers.
static QIcon iconForLayer(const QgsMapLayer *layer)
Returns the icon corresponding to a specified map layer.
static QIcon iconMesh()
Returns an icon representing mesh layers.
static QIcon iconVectorTile()
Returns an icon representing vector tile layers.
Base class for all map layer types.
Base class for plugin layers.
Represents a vector layer which manages a vector based dataset.
Q_INVOKABLE Qgis::GeometryType geometryType() const
Returns point, line or polygon.
static Qgis::GeometryType geometryType(Qgis::WkbType type)
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...