diff --git a/python/core/auto_generated/qgsmaplayer.sip.in b/python/core/auto_generated/qgsmaplayer.sip.in index 2c640567f17..bb9b2ed0846 100644 --- a/python/core/auto_generated/qgsmaplayer.sip.in +++ b/python/core/auto_generated/qgsmaplayer.sip.in @@ -1436,6 +1436,8 @@ Returns the layer's elevation properties. This may be ``None``, depending on the Returns path to the placeholder image or an empty string if a generated legend is shown :return: placholder image path + +.. versionadded:: 3.22 %End void setLegendPlaceholderImage( const QString &imgPath ); diff --git a/src/core/qgsmaplayer.h b/src/core/qgsmaplayer.h index b39bfcc158c..c5ac3beb4cd 100644 --- a/src/core/qgsmaplayer.h +++ b/src/core/qgsmaplayer.h @@ -1282,6 +1282,7 @@ class CORE_EXPORT QgsMapLayer : public QObject /** * Returns path to the placeholder image or an empty string if a generated legend is shown * \return placholder image path + * \since QGIS 3.22 */ QString legendPlaceholderImage() const { return mLegendPlaceholderImage;} diff --git a/src/core/qgsmaplayerlegend.cpp b/src/core/qgsmaplayerlegend.cpp index d95251d2a61..1c06baffab9 100644 --- a/src/core/qgsmaplayerlegend.cpp +++ b/src/core/qgsmaplayerlegend.cpp @@ -365,9 +365,8 @@ QList QgsDefaultVectorLayerLegend::createLayerTre QString placeholderImage = mLayer->legendPlaceholderImage(); if ( !placeholderImage.isEmpty() ) { - QgsImageCache ic; bool fitsInCache; - QImage img = ic.pathAsImage( placeholderImage, QSize(), false, 1.0, fitsInCache ); + QImage img = QgsApplication::imageCache()->pathAsImage( placeholderImage, QSize(), false, 1.0, fitsInCache ); nodes << new QgsImageLegendNode( nodeLayer, img ); return nodes; } @@ -519,9 +518,8 @@ QList QgsDefaultRasterLayerLegend::createLayerTre QString placeholderImage = mLayer->legendPlaceholderImage(); if ( !placeholderImage.isEmpty() ) { - QgsImageCache ic; bool fitsInCache; - QImage img = ic.pathAsImage( placeholderImage, QSize(), false, 1.0, fitsInCache ); + QImage img = QgsApplication::imageCache()->pathAsImage( placeholderImage, QSize(), false, 1.0, fitsInCache ); nodes << new QgsImageLegendNode( nodeLayer, img ); } else if ( mLayer->renderer() )