Bug report #18896

"Hide deprecated CRSs" functionality not working properly in the Coordinate Reference System Selector dialog

Added by Andrea Giudiceandrea over 6 years ago. Updated over 6 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:GUI
Affected QGIS version:3.0.2 Regression?:Yes
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:26728

Description

The "Hide deprecated CRSs" functionality in the Coordinate Reference System Selector dialog (Project Properties | CRS) doesn't work properly in conjunction with the "Filter" feature for both QGIS 3.0.2, 2.18.19 and probably also master.

If I check the "Hide deprecated CRSs" checkbox and then put a search string, e.g. "samoa", in the "Filter" field I obtain the CRSs list:
[CRSs list A]

+ Geographic Coordinate Systems
     American Samoa 1962
+ Projected Coordinate Systems
  + Lambert Conformal Conic
        American Samoa 1962 / American Samoa Lambert
        American Samoa 1962 / American Samoa Lambert (deprecated)
        American Samoa 1962 / American Samoa Lambert (deprecated)

that is wrong, because deprecated CRSs are displayed instead of hidden

and if I subsequently uncheck the "Hide deprecated CRSs" checkbox, then wrongly again additional deprecated CRSs not related with the Samoa ones are added to the list!:
[CRSs list B]

+ Geographic Coordinate Systems
     American Samoa 1962
+ Projected Coordinate Systems
  + Lambert Conformal Conic
        American Samoa 1962 / American Samoa Lambert
        American Samoa 1962 / American Samoa Lambert (deprecated)
        American Samoa 1962 / American Samoa Lambert (deprecated)
        MGI / Austria Lambert (deprecated)
        Merchich / Sahara (deprecated)
        NAD27 / California zone VII (deprecated)
        NAD27 / Cuba Norte (deprecated)
        NAD27 / Cuba Sur (deprecated)
        ... and so on...

If, instead, I start the search (putting for example again "samoa" in the "Filter" field) with the "Hide deprecated CRSs" checkbox unchecked, I obtain the [CRSs list A] as expected. If I subsequently check it, the two deprecated Samoa CRSs will be correctly deleted from the list, but if I uncheck it again, the [CRSs list B] is displayed and this is wrong again!

I think the problem is in QgsProjectionSelectionTreeWidget Class (src/gui/qgsprojectionselectiontreewidget.cpp ) :: hideDeprecated, cbxHideDeprecated_stateChanged, leSearch_textChanged for QGIS 3.0 and in QgsProjectionSelector Class (src/gui/qgsprojectionselector.cpp) :: hideDeprecated, on_cbxHideDeprecated_stateChanged, on_leSearch_textChanged for QGIS 2.18.

Hope this historical research will help to fix the problem:
the "Hide deprecated CRSs" functionality was introduced by Jürgen E. Fischer with commit "[FEATURE] allow to hide deprecated CRSes" [1] in QGIS 1.5.0 and worked fine until QGIS 1.7.4. In QGIS 1.8.0 the projections dialog was redesigned (in a way very similar to the current one) by Richard Duivenvoorde and Nathan Woodrow (see Feature Request #4550 [2], Pull Request 66 [3], commit 36e178f [4]) but the "Hide deprecated CRSs" functionality was partially broken inadvertently and since then it doesn't work as supposed to (but it seems that no one else has noticed it).

[1] d323a6ca35336f5c6b65dafbec8a3ad88e99e2d7
[2] "Improvements to projection widget" #4550
[3] "for #4550 projection ui work #66" https://github.com/qgis/QGIS/pull/66
[4] "UI tweaks to the projection UI; Remove old buttons and code etc" 36e178f7c4d342d06a9f336eeae64b4f6371bf1e

Associated revisions

Revision a022ad21
Added by Nyall Dawson over 6 years ago

Fix handling of "hide deprecated" in projection selector widget

Fixes #18896

Revision 1c5d8602
Added by Nyall Dawson over 6 years ago

Fix handling of "hide deprecated" in projection selector widget

Fixes #18896

(cherry-picked from a022ad21)

History

#1 Updated by Nyall Dawson over 6 years ago

  • Pull Request or Patch supplied changed from No to Yes
  • Status changed from Open to In Progress

#2 Updated by Nyall Dawson over 6 years ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

#3 Updated by Jürgen Fischer over 6 years ago

  • Description updated (diff)

#4 Updated by Andrea Giudiceandrea over 6 years ago

Hope this will back ported to 2.18.

Also available in: Atom PDF