After using some non usual SRC for demonstration purpose, I wish to clear my "Recently used coordinate reference systems" list for the sake of praticity.
Is it possible?
I am using QGIS 2.10.1.
Yes, you can enter the following code in the Python console to remove all Recently used coordinate reference systems from the user interface:
from PyQt4.QtCore import QSettings
QSettings().remove('UI/recentProjections')
QSettings().remove('UI/recentProjectionsAuthId')
Now I'm not sure why exactly but, for me atleast, using one remove
method was not enough. I had to use both (the order does not matter either aslong as both are used).
But it works for me anyway and hopefully for you too!
You could use the following:
from PyQt5.QtCore import QSettings
QSettings().remove('UI/recentProjections')
Or to import QSettings
generically (i.e. from differing major QGIS versions), you could use the following (thanks to @TeddyTedTed):
from qgis.PyQt.QtCore import QSettings
QSettings
which stores user interface settings which they could add the above function to.
PyQt4
or PyQt5
etc.
QSettings().remove('UI/recentProjections')
This worked QGIS 3.22.1. It appears they changed recentProjections
to recentProjectionsWkt
at some point. To get it to work, I executed the following Python Commands:
from qgis.PyQt.QtCore import QSettings
QSettings().remove('UI/recentProjectionsWkt')
QSettings().remove('UI/recentProjectionsAuthId')