File tree 1 file changed +12
-7
lines changed
1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -488,11 +488,6 @@ void QgsMapCanvas::refreshMap()
488
488
if ( !mTheme .isEmpty () )
489
489
{
490
490
mSettings .setLayerStyleOverrides ( QgsProject::instance ()->mapThemeCollection ()->mapThemeStyleOverrides ( mTheme ) );
491
- mSettings .setLayers ( QgsProject::instance ()->mapThemeCollection ()->mapThemeVisibleLayers ( mTheme ) );
492
- }
493
- else
494
- {
495
- mSettings .setLayerStyleOverrides ( QMap< QString, QString>() );
496
491
}
497
492
498
493
// create the renderer job
@@ -1623,9 +1618,19 @@ void QgsMapCanvas::setTheme( const QString &theme )
1623
1618
if ( mTheme == theme )
1624
1619
return ;
1625
1620
1626
- mTheme = theme;
1627
1621
clearCache ();
1628
- emit themeChanged ( theme );
1622
+ if ( theme.isEmpty () || !QgsProject::instance ()->mapThemeCollection ()->hasMapTheme ( theme ) )
1623
+ {
1624
+ mTheme .clear ();
1625
+ mSettings .setLayerStyleOverrides ( QMap< QString, QString>() );
1626
+ emit themeChanged ( QString () );
1627
+ }
1628
+ else
1629
+ {
1630
+ mTheme = theme;
1631
+ setLayers ( QgsProject::instance ()->mapThemeCollection ()->mapThemeVisibleLayers ( mTheme ) );
1632
+ emit themeChanged ( theme );
1633
+ }
1629
1634
}
1630
1635
1631
1636
void QgsMapCanvas::setRenderFlag ( bool flag )
You can’t perform that action at this time.
0 commit comments