Monday, 30 April 2018

pyqgis - How to read out which map theme is used in QGIS 3



I'm using QGIS 3.2.2 and Python. I would like to read out which map theme I currently use.


enter image description here


I know the following method provides me a list of defined map themes ('Theme1', 'Theme2'):


QgsProject.instance().mapThemeCollection().mapThemes() 

I don't know any method which provides me with the map theme name used itself.


I tried to use iface.mapCanvas().theme() but it always returns an empty string.




No comments:

Post a Comment