Skip to content
Permalink
Browse files

Fix setting layers to match canvas theme

  • Loading branch information
nyalldawson committed Mar 12, 2017
1 parent 1e6bffe commit 40f3c8c3bd2f53c6817863bf3f6d08435fafdb3b
Showing with 12 additions and 7 deletions.
  1. +12 −7 src/gui/qgsmapcanvas.cpp
@@ -488,11 +488,6 @@ void QgsMapCanvas::refreshMap()
if ( !mTheme.isEmpty() )
{
mSettings.setLayerStyleOverrides( QgsProject::instance()->mapThemeCollection()->mapThemeStyleOverrides( mTheme ) );
mSettings.setLayers( QgsProject::instance()->mapThemeCollection()->mapThemeVisibleLayers( mTheme ) );
}
else
{
mSettings.setLayerStyleOverrides( QMap< QString, QString>() );
}

// create the renderer job
@@ -1623,9 +1618,19 @@ void QgsMapCanvas::setTheme( const QString &theme )
if ( mTheme == theme )
return;

mTheme = theme;
clearCache();
emit themeChanged( theme );
if ( theme.isEmpty() || !QgsProject::instance()->mapThemeCollection()->hasMapTheme( theme ) )
{
mTheme.clear();
mSettings.setLayerStyleOverrides( QMap< QString, QString>() );
emit themeChanged( QString() );
}
else
{
mTheme = theme;
setLayers( QgsProject::instance()->mapThemeCollection()->mapThemeVisibleLayers( mTheme ) );
emit themeChanged( theme );
}
}

void QgsMapCanvas::setRenderFlag( bool flag )

0 comments on commit 40f3c8c

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