Skip to content
Permalink
Browse files
Ensure browser preview canvases don't get treated like map canvas
docks

They have their own special logic, and shouldn't respond to
any project based settings or triggers

Fixes #20362

(cherry picked from commit c54c559)
  • Loading branch information
nyalldawson committed Nov 10, 2018
1 parent d43d28b commit 3730579d13e733c1c93b73b7f084848a280b0af9
Showing with 10 additions and 1 deletion.
  1. +9 −1 src/app/qgisapp.cpp
  2. +1 −0 src/gui/qgsbrowserdockwidget_p.cpp
@@ -8181,7 +8181,15 @@ QList<QgsMapCanvasAnnotationItem *> QgisApp::annotationItems()

QList<QgsMapCanvas *> QgisApp::mapCanvases()
{
return findChildren< QgsMapCanvas * >();
// filter out browser canvases -- they are children of app, but a different
// kind of beast, and here we only want the main canvas or dock canvases
auto canvases = findChildren< QgsMapCanvas * >();
canvases.erase( std::remove_if( canvases.begin(), canvases.end(),
[]( QgsMapCanvas * canvas )
{
return !canvas || canvas->property( "browser_canvas" ).toBool();
} ), canvases.end() );
return canvases;
}

void QgisApp::removeAnnotationItems()
@@ -121,6 +121,7 @@ QgsBrowserLayerProperties::QgsBrowserLayerProperties( QWidget *parent )
mMetadataTextBrowser->setOpenLinks( false );
connect( mMetadataTextBrowser, &QTextBrowser::anchorClicked, this, &QgsBrowserLayerProperties::urlClicked );

mMapCanvas->setProperty( "browser_canvas", true );
mMapCanvas->setLayers( QList< QgsMapLayer * >() );
mMapCanvas->setMapTool( new QgsMapToolPan( mMapCanvas ) );
mMapCanvas->freeze( true );

0 comments on commit 3730579

Please sign in to comment.