mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Use application image cache
This commit is contained in:
parent
d76fa2bf3b
commit
f287872798
@ -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 );
|
||||
|
@ -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;}
|
||||
|
||||
|
@ -365,9 +365,8 @@ QList<QgsLayerTreeModelLegendNode *> 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<QgsLayerTreeModelLegendNode *> 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() )
|
||||
|
Loading…
x
Reference in New Issue
Block a user