Skip to content
Permalink
Browse files

Clearing map canvas theme falls back to project layers

  • Loading branch information
nyalldawson committed Mar 13, 2017
1 parent 7f85169 commit 0d0a81b00d4bf4600735ee05f56a2f71fc767a95
Showing with 9 additions and 3 deletions.
  1. +1 −0 src/gui/qgsmapcanvas.cpp
  2. +1 −3 src/gui/qgsmapcanvas.h
  3. +7 −0 tests/src/python/test_qgsmapcanvas.py
@@ -1648,6 +1648,7 @@ void QgsMapCanvas::setTheme( const QString &theme )
{
mTheme.clear();
mSettings.setLayerStyleOverrides( QMap< QString, QString>() );
setLayers( QgsProject::instance()->mapThemeCollection()->masterVisibleLayers() );
emit themeChanged( QString() );
}
else
@@ -323,9 +323,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
* QgsLayerTreeMapCanvasBridge.
*
* If an empty string is passed then the current theme association will be
* cleared. The layers from the previously associated theme will remain
* in the canvas, and a call to setLayers() may be necessary to define
* which layers should be shown in the canvas.
* cleared.
* @note added in QGIS 3.0
* @see theme()
*/
@@ -314,6 +314,13 @@ def testMapTheme(self):
canvas.waitWhileRendering()
self.assertTrue(self.canvasImageCheck('theme4', 'theme4', canvas))

# clear theme
canvas.setTheme('')
canvas.refresh()
canvas.waitWhileRendering()
# should be different - we should now render project layers
self.assertFalse(self.canvasImageCheck('theme4', 'theme4', canvas))

def canvasImageCheck(self, name, reference_image, canvas):
self.report += "<h2>Render {}</h2>\n".format(name)
temp_dir = QDir.tempPath() + '/'

0 comments on commit 0d0a81b

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