mirror of
https://github.com/qgis/QGIS.git
synced 2025-06-19 00:02:48 -04:00
Fix unnecessary layer reloads triggering after project load, which
also causes a leak
This commit is contained in:
parent
e3ad35bb32
commit
b3c1719e98
@ -728,9 +728,27 @@ Repaints the canvas map
|
|||||||
|
|
||||||
void refreshAllLayers();
|
void refreshAllLayers();
|
||||||
%Docstring
|
%Docstring
|
||||||
Reload all layers, clear the cache and refresh the canvas
|
Reload all layers (including refreshing layer properties from their data sources),
|
||||||
|
clears the cache and refreshes the canvas.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Consider using the less expensive redrawAllLayers() method if a layer reload
|
||||||
|
from the data provider is not required.
|
||||||
|
|
||||||
.. versionadded:: 2.9
|
.. versionadded:: 2.9
|
||||||
|
%End
|
||||||
|
|
||||||
|
void redrawAllLayers();
|
||||||
|
%Docstring
|
||||||
|
Clears all cached images and redraws all layers.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Unlike refreshAllLayers(), this does NOT reload layers themselves, and accordingly
|
||||||
|
is more "lightweight". Use this method when only an update of the layer's renderers is required.
|
||||||
|
|
||||||
|
.. versionadded:: 3.10
|
||||||
%End
|
%End
|
||||||
|
|
||||||
void selectionChangedSlot();
|
void selectionChangedSlot();
|
||||||
|
@ -4308,7 +4308,7 @@ void QgsLayoutDesignerDialog::atlasFeatureChanged( const QgsFeature &feature )
|
|||||||
mapCanvas->expressionContextScope().addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "atlas_featureid" ), feature.id(), true ) );
|
mapCanvas->expressionContextScope().addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "atlas_featureid" ), feature.id(), true ) );
|
||||||
mapCanvas->expressionContextScope().addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "atlas_geometry" ), QVariant::fromValue( feature.geometry() ), true ) );
|
mapCanvas->expressionContextScope().addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "atlas_geometry" ), QVariant::fromValue( feature.geometry() ), true ) );
|
||||||
mapCanvas->stopRendering();
|
mapCanvas->stopRendering();
|
||||||
mapCanvas->refreshAllLayers();
|
mapCanvas->redrawAllLayers();
|
||||||
|
|
||||||
mView->setSectionLabel( atlas->nameForPage( atlas->currentFeatureNumber() ) );
|
mView->setSectionLabel( atlas->nameForPage( atlas->currentFeatureNumber() ) );
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ void QgsStatusBarCoordinatesWidget::refreshMapCanvas()
|
|||||||
|
|
||||||
//stop any current rendering
|
//stop any current rendering
|
||||||
mMapCanvas->stopRendering();
|
mMapCanvas->stopRendering();
|
||||||
mMapCanvas->refreshAllLayers();
|
mMapCanvas->redrawAllLayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsStatusBarCoordinatesWidget::showMouseCoordinates( const QgsPointXY &p )
|
void QgsStatusBarCoordinatesWidget::showMouseCoordinates( const QgsPointXY &p )
|
||||||
|
@ -154,10 +154,10 @@ QgsMapCanvas::QgsMapCanvas( QWidget *parent )
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
// refresh canvas when a remote svg/image has finished downloading
|
// refresh canvas when a remote svg/image has finished downloading
|
||||||
connect( QgsApplication::svgCache(), &QgsSvgCache::remoteSvgFetched, this, &QgsMapCanvas::refreshAllLayers );
|
connect( QgsApplication::svgCache(), &QgsSvgCache::remoteSvgFetched, this, &QgsMapCanvas::redrawAllLayers );
|
||||||
connect( QgsApplication::imageCache(), &QgsImageCache::remoteImageFetched, this, &QgsMapCanvas::refreshAllLayers );
|
connect( QgsApplication::imageCache(), &QgsImageCache::remoteImageFetched, this, &QgsMapCanvas::redrawAllLayers );
|
||||||
// refresh canvas when project color scheme is changed -- if layers use project colors, they need to be redrawn
|
// refresh canvas when project color scheme is changed -- if layers use project colors, they need to be redrawn
|
||||||
connect( QgsProject::instance(), &QgsProject::projectColorsChanged, this, &QgsMapCanvas::refreshAllLayers );
|
connect( QgsProject::instance(), &QgsProject::projectColorsChanged, this, &QgsMapCanvas::redrawAllLayers );
|
||||||
|
|
||||||
//segmentation parameters
|
//segmentation parameters
|
||||||
QgsSettings settings;
|
QgsSettings settings;
|
||||||
@ -2211,6 +2211,11 @@ void QgsMapCanvas::refreshAllLayers()
|
|||||||
layer->reload();
|
layer->reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
redrawAllLayers();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QgsMapCanvas::redrawAllLayers()
|
||||||
|
{
|
||||||
// clear the cache
|
// clear the cache
|
||||||
clearCache();
|
clearCache();
|
||||||
|
|
||||||
|
@ -645,11 +645,26 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
|
|||||||
void refresh();
|
void refresh();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reload all layers, clear the cache and refresh the canvas
|
* Reload all layers (including refreshing layer properties from their data sources),
|
||||||
|
* clears the cache and refreshes the canvas.
|
||||||
|
*
|
||||||
|
* \note Consider using the less expensive redrawAllLayers() method if a layer reload
|
||||||
|
* from the data provider is not required.
|
||||||
|
*
|
||||||
* \since QGIS 2.9
|
* \since QGIS 2.9
|
||||||
*/
|
*/
|
||||||
void refreshAllLayers();
|
void refreshAllLayers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears all cached images and redraws all layers.
|
||||||
|
*
|
||||||
|
* \note Unlike refreshAllLayers(), this does NOT reload layers themselves, and accordingly
|
||||||
|
* is more "lightweight". Use this method when only an update of the layer's renderers is required.
|
||||||
|
*
|
||||||
|
* \since QGIS 3.10
|
||||||
|
*/
|
||||||
|
void redrawAllLayers();
|
||||||
|
|
||||||
//! Receives signal about selection change, and pass it on with layer info
|
//! Receives signal about selection change, and pass it on with layer info
|
||||||
void selectionChangedSlot();
|
void selectionChangedSlot();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user