Bug report #18896

Updated by Jürgen Fischer almost 6 years ago

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]
<pre>
+ 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)
</pre>

*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]
<pre>
+ 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...
</pre>

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] commit:d323a6ca35336f5c6b65dafbec8a3ad88e99e2d7 https://github.com/qgis/QGIS/commit/d323a6ca35336f5c6b65dafbec8a3ad88e99e2d7
[2] "Improvements to projection widget" #4550 https://issues.qgis.org/issues/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" commit:36e178f7c4d342d06a9f336eeae64b4f6371bf1e https://github.com/qgis/QGIS/commit/36e178f7c4d342d06a9f336eeae64b4f6371bf1e

Back