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
  • Loading branch information
nyalldawson committed Nov 5, 2018
1 parent 0ea86bf commit c54c5597232a5f50e1967ec3a552c2c02b1da0af
Showing with 10 additions and 1 deletion.
  1. +9 −1 src/app/qgisapp.cpp
  2. +1 −0 src/gui/qgsbrowserdockwidget_p.cpp
@@ -8203,7 +8203,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 c54c559

Please sign in to comment.
You can’t perform that action at this time.