@@ -52,14 +52,25 @@ QgsProjectionSelector::QgsProjectionSelector( QWidget* parent, const char *name,
52
52
lstCoordinateSystems->header ()->setResizeMode ( AUTHID_COLUMN, QHeaderView::Stretch );
53
53
lstCoordinateSystems->header ()->resizeSection ( QGIS_CRS_ID_COLUMN, 0 );
54
54
lstCoordinateSystems->header ()->setResizeMode ( QGIS_CRS_ID_COLUMN, QHeaderView::Fixed );
55
+ // Hide (internal) ID column
56
+ lstCoordinateSystems->setColumnHidden (QGIS_CRS_ID_COLUMN, true );
55
57
56
58
lstRecent->header ()->setResizeMode ( AUTHID_COLUMN, QHeaderView::Stretch );
57
59
lstRecent->header ()->resizeSection ( QGIS_CRS_ID_COLUMN, 0 );
58
60
lstRecent->header ()->setResizeMode ( QGIS_CRS_ID_COLUMN, QHeaderView::Fixed );
61
+ // Hide (internal) ID column
62
+ lstRecent->setColumnHidden (QGIS_CRS_ID_COLUMN, true );
59
63
60
64
cbxAuthority->addItem ( tr ( " All" ) );
61
65
cbxAuthority->addItems ( authorities () );
62
66
67
+ // TEMP? hide buttons, we now implemented filter
68
+ cbxAuthority->hide ();
69
+ cbxMode->hide ();
70
+ label->hide ();
71
+ label_2->hide ();
72
+ pbnFind->hide ();
73
+
63
74
// Read settings from persistent storage
64
75
QSettings settings;
65
76
mRecentProjections = settings.value ( " /UI/recentProjections" ).toStringList ();
@@ -189,7 +200,6 @@ QString QgsProjectionSelector::ogcWmsCrsFilterAsSqlExpression( QSet<QString> * c
189
200
{
190
201
return sqlExpression;
191
202
}
192
-
193
203
/*
194
204
Ref: WMS 1.3.0, section 6.7.3 "Layer CRS":
195
205
@@ -794,7 +804,8 @@ void QgsProjectionSelector::loadCrsList( QSet<QString> *crsFilter )
794
804
newItem->setText ( AUTHID_COLUMN, QString::fromUtf8 (( char * )sqlite3_column_text ( ppStmt, 2 ) ) );
795
805
// display the qgis srs_id (field 1) in the third column of the list view
796
806
newItem->setText ( QGIS_CRS_ID_COLUMN, QString::fromUtf8 (( char * )sqlite3_column_text ( ppStmt, 1 ) ) );
797
-
807
+ // expand also parent node
808
+ newItem->parent ()->setExpanded (true );
798
809
}
799
810
800
811
// display the qgis deprecated in the user data of the item
@@ -982,6 +993,65 @@ void QgsProjectionSelector::on_pbnFind_clicked()
982
993
teProjection->setText ( " " );
983
994
}
984
995
996
+ void QgsProjectionSelector::on_leSearch_textChanged ( const QString & theFilterTxt)
997
+ {
998
+ // filter recent crs's
999
+ QTreeWidgetItemIterator itr (lstRecent);
1000
+ while (*itr) {
1001
+ if ( (*itr)->childCount () == 0 ) // it's an end node aka a projection
1002
+ {
1003
+ if ( (*itr)->text ( NAME_COLUMN ).contains ( theFilterTxt, Qt::CaseInsensitive )
1004
+ || (*itr)->text ( AUTHID_COLUMN ).contains ( theFilterTxt, Qt::CaseInsensitive )
1005
+ )
1006
+ {
1007
+ (*itr)->setHidden (false );
1008
+ QTreeWidgetItem * parent = (*itr)->parent ();
1009
+ while (parent != NULL )
1010
+ {
1011
+ parent->setExpanded (true );
1012
+ parent->setHidden (false );
1013
+ parent = parent->parent ();
1014
+ }
1015
+ }
1016
+ else {
1017
+ (*itr)->setHidden (true );
1018
+ }
1019
+ }
1020
+ else {
1021
+ (*itr)->setHidden (true );
1022
+ }
1023
+ ++itr;
1024
+ }
1025
+ // filter crs's
1026
+ QTreeWidgetItemIterator it (lstCoordinateSystems);
1027
+ while (*it) {
1028
+ if ( (*it)->childCount () == 0 ) // it's an end node aka a projection
1029
+ {
1030
+ if ( (*it)->text ( NAME_COLUMN ).contains ( theFilterTxt, Qt::CaseInsensitive )
1031
+ || (*it)->text ( AUTHID_COLUMN ).contains ( theFilterTxt, Qt::CaseInsensitive )
1032
+ )
1033
+ {
1034
+ (*it)->setHidden (false );
1035
+ QTreeWidgetItem * parent = (*it)->parent ();
1036
+ while (parent != NULL )
1037
+ {
1038
+ parent->setExpanded (true );
1039
+ parent->setHidden (false );
1040
+ parent = parent->parent ();
1041
+ }
1042
+ }
1043
+ else {
1044
+ (*it)->setHidden (true );
1045
+ }
1046
+ }
1047
+ else {
1048
+ (*it)->setHidden (true );
1049
+ }
1050
+ ++it;
1051
+ }
1052
+ }
1053
+
1054
+
985
1055
long QgsProjectionSelector::getLargestCRSIDMatch ( QString theSql )
986
1056
{
987
1057
long mySrsId = 0 ;
@@ -1094,7 +1164,7 @@ QStringList QgsProjectionSelector::authorities()
1094
1164
return authorities;
1095
1165
}
1096
1166
1097
- /* !
1167
+ /* !linfinity qtcreator qgis
1098
1168
* \brief Make the string safe for use in SQL statements.
1099
1169
* This involves escaping single quotes, double quotes, backslashes,
1100
1170
* and optionally, percentage symbols. Percentage symbols are used
0 commit comments