Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix all layers are force redrawed whenever a filter is changed in any
  • Loading branch information
nyalldawson committed May 20, 2019
1 parent bfe746d commit eed742a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/app/qgisapp.cpp
Expand Up @@ -2165,7 +2165,7 @@ void QgisApp::createActions()
connect( mActionZoomActualSize, &QAction::triggered, this, &QgisApp::zoomActualSize );
connect( mActionMapTips, &QAction::toggled, this, &QgisApp::toggleMapTips );
connect( mActionNewBookmark, &QAction::triggered, this, &QgisApp::newBookmark );
connect( mActionDraw, &QAction::triggered, this, &QgisApp::refreshMapCanvas );
connect( mActionDraw, &QAction::triggered, this, [this] { refreshMapCanvas( true ); } );
connect( mActionTextAnnotation, &QAction::triggered, this, &QgisApp::addTextAnnotation );
connect( mActionFormAnnotation, &QAction::triggered, this, &QgisApp::addFormAnnotation );
connect( mActionHtmlAnnotation, &QAction::triggered, this, &QgisApp::addHtmlAnnotation );
Expand Down Expand Up @@ -9159,13 +9159,16 @@ void QgisApp::copyFeatures( QgsFeatureStore &featureStore )
clipboard()->replaceWithCopyOf( featureStore );
}

void QgisApp::refreshMapCanvas()
void QgisApp::refreshMapCanvas( bool redrawAllLayers )
{
Q_FOREACH ( QgsMapCanvas *canvas, mapCanvases() )
{
//stop any current rendering
canvas->stopRendering();
canvas->refreshAllLayers();
if ( redrawAllLayers )
canvas->refreshAllLayers();
else
canvas->refresh();
}
}

Expand Down Expand Up @@ -12102,7 +12105,7 @@ void QgisApp::layersWereAdded( const QList<QgsMapLayer *> &layers )
if ( provider )
{
connect( provider, &QgsDataProvider::dataChanged, layer, [layer] { layer->triggerRepaint(); } );
connect( provider, &QgsDataProvider::dataChanged, this, &QgisApp::refreshMapCanvas );
connect( provider, &QgsDataProvider::dataChanged, this, [this] { refreshMapCanvas(); } );
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisapp.h
Expand Up @@ -1441,7 +1441,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
void selectByForm();

//! refresh map canvas
void refreshMapCanvas();
void refreshMapCanvas( bool redrawAllLayers = false );

//! start "busy" progress bar
void canvasRefreshStarted();
Expand Down

0 comments on commit eed742a

Please sign in to comment.