10

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.

0

2 Answers 2

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
8
  • 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
    Commented Sep 25, 2015 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
    Commented Sep 30, 2015 at 9:35
  • 1
    Thanks @Joseph. For QGIS 3.x use - "from qgis.PyQt.QtCore import QSettings" Commented Feb 20, 2019 at 9:36
  • 1
    @TeddyTedTed - Thanks for your comment, that is certainly a more generic method instead of specifying PyQt4 or PyQt5 etc.
    – Joseph
    Commented Feb 20, 2019 at 10:06
  • 1
    In QGIS 3.6.3 the second line is QSettings().remove('UI/recentProjections')
    – aldeano
    Commented Jun 10, 2019 at 21:12
0

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') 
2
  • 3.30.2 this works beautifully, thanks. The earlier versions draw a blank. Commented Jul 25, 2023 at 15:50
  • Also works on 3.32.1 Lima...eventually! Commented Aug 14, 2023 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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