Skip to content

Commit cdfe7bc

Browse files
nyalldawsonnirvn
authored andcommittedMay 21, 2019
Fix all layers are force redrawed whenever a filter is changed in any
1 parent e609428 commit cdfe7bc

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2165,7 +2165,7 @@ void QgisApp::createActions()
21652165
connect( mActionZoomActualSize, &QAction::triggered, this, &QgisApp::zoomActualSize );
21662166
connect( mActionMapTips, &QAction::toggled, this, &QgisApp::toggleMapTips );
21672167
connect( mActionNewBookmark, &QAction::triggered, this, &QgisApp::newBookmark );
2168-
connect( mActionDraw, &QAction::triggered, this, &QgisApp::refreshMapCanvas );
2168+
connect( mActionDraw, &QAction::triggered, this, [this] { refreshMapCanvas( true ); } );
21692169
connect( mActionTextAnnotation, &QAction::triggered, this, &QgisApp::addTextAnnotation );
21702170
connect( mActionFormAnnotation, &QAction::triggered, this, &QgisApp::addFormAnnotation );
21712171
connect( mActionHtmlAnnotation, &QAction::triggered, this, &QgisApp::addHtmlAnnotation );
@@ -9159,13 +9159,16 @@ void QgisApp::copyFeatures( QgsFeatureStore &featureStore )
91599159
clipboard()->replaceWithCopyOf( featureStore );
91609160
}
91619161

9162-
void QgisApp::refreshMapCanvas()
9162+
void QgisApp::refreshMapCanvas( bool redrawAllLayers )
91639163
{
91649164
Q_FOREACH ( QgsMapCanvas *canvas, mapCanvases() )
91659165
{
91669166
//stop any current rendering
91679167
canvas->stopRendering();
9168-
canvas->refreshAllLayers();
9168+
if ( redrawAllLayers )
9169+
canvas->refreshAllLayers();
9170+
else
9171+
canvas->refresh();
91699172
}
91709173
}
91719174

@@ -12102,7 +12105,7 @@ void QgisApp::layersWereAdded( const QList<QgsMapLayer *> &layers )
1210212105
if ( provider )
1210312106
{
1210412107
connect( provider, &QgsDataProvider::dataChanged, layer, [layer] { layer->triggerRepaint(); } );
12105-
connect( provider, &QgsDataProvider::dataChanged, this, &QgisApp::refreshMapCanvas );
12108+
connect( provider, &QgsDataProvider::dataChanged, this, [this] { refreshMapCanvas(); } );
1210612109
}
1210712110
}
1210812111
}

‎src/app/qgisapp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
14411441
void selectByForm();
14421442

14431443
//! refresh map canvas
1444-
void refreshMapCanvas();
1444+
void refreshMapCanvas( bool redrawAllLayers = false );
14451445

14461446
//! start "busy" progress bar
14471447
void canvasRefreshStarted();

0 commit comments

Comments
 (0)