9

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.

9

QGIS 2.x

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!


QGIS 3.x

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
  • 3
    Thanks Joseph, works great. I made a Feature Request for this to be included in the GUI, to facilitate the task for standard users. – RASC Sep 25 '15 at 17:41
  • @RASC - Awesome buddy, glad it works! There is an option to reset the QSettings which stores user interface settings which they could add the above function to. – Joseph Sep 30 '15 at 9:35
  • 1
    Thanks @Joseph. For QGIS 3.x use - "from qgis.PyQt.QtCore import QSettings" – TeddyTedTed Feb 20 at 9:36
  • 1
    @TeddyTedTed - Thanks for your comment, that is certainly a more generic method instead of specifying PyQt4 or PyQt5 etc. – Joseph Feb 20 at 10:06
  • 1
    In QGIS 3.6.3 the second line is QSettings().remove('UI/recentProjections') – aldeano Jun 10 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.