[QGIS Commit] r14241 - in trunk/qgis/src: app/attributetable ui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Sep 16 18:52:26 EDT 2010


Author: timlinux
Date: 2010-09-16 22:52:26 +0000 (Thu, 16 Sep 2010)
New Revision: 14241

Modified:
   trunk/qgis/src/app/attributetable/qgsattributetabledialog.cpp
   trunk/qgis/src/ui/qgsattributetabledialog.ui
Log:
Applied patch to close #25 - allow case insensitive search of attribute table

Modified: trunk/qgis/src/app/attributetable/qgsattributetabledialog.cpp
===================================================================
--- trunk/qgis/src/app/attributetable/qgsattributetabledialog.cpp	2010-09-16 22:35:07 UTC (rev 14240)
+++ trunk/qgis/src/app/attributetable/qgsattributetabledialog.cpp	2010-09-16 22:52:26 UTC (rev 14241)
@@ -627,12 +627,16 @@
   int fldIndex = mLayer->fieldNameIndex( fieldName );
   QVariant::Type fldType = flds[fldIndex].type();
   bool numeric = ( fldType == QVariant::Int || fldType == QVariant::Double );
+  QString sensString = "ILIKE";
+  if (cbxCaseSensitive->isChecked()) {
+     sensString = "LIKE";
+  }
 
   QString str = QString( "%1 %2 '%3'" )
                 .arg( QgsSearchTreeNode::quotedColumnRef( fieldName ) )
-                .arg( numeric ? "=" : "~" )
-                .arg( mQuery->displayText().replace( "'", "''" ) ); // escape quotes
-
+                .arg( numeric ? "=" : sensString )
+                .arg( numeric ? mQuery->displayText().replace( "'", "''" ) :
+                                "%" + mQuery->displayText().replace ("'", "''") + "%"  ); // escape quotes
   doSearch( str );
 }
 

Modified: trunk/qgis/src/ui/qgsattributetabledialog.ui
===================================================================
--- trunk/qgis/src/ui/qgsattributetabledialog.ui	2010-09-16 22:35:07 UTC (rev 14240)
+++ trunk/qgis/src/ui/qgsattributetabledialog.ui	2010-09-16 22:52:26 UTC (rev 14241)
@@ -26,18 +26,28 @@
      <item>
       <widget class="QCheckBox" name="cbxShowSelectedOnly">
        <property name="text">
-        <string>Show selected records only</string>
+        <string>Show selected only</string>
        </property>
       </widget>
      </item>
      <item>
       <widget class="QCheckBox" name="cbxSearchSelectedOnly">
        <property name="text">
-        <string>Search selected records only</string>
+        <string>Search selected only</string>
        </property>
       </widget>
      </item>
      <item>
+      <widget class="QCheckBox" name="cbxCaseSensitive">
+       <property name="text">
+        <string>Case sensitive</string>
+       </property>
+       <property name="checked">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
       <spacer>
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
@@ -68,8 +78,14 @@
      </item>
      <item>
       <widget class="QPushButton" name="mHelpButton">
+       <property name="minimumSize">
+        <size>
+         <width>85</width>
+         <height>0</height>
+        </size>
+       </property>
        <property name="text">
-        <string>Help</string>
+        <string>?</string>
        </property>
       </widget>
      </item>



More information about the QGIS-commit mailing list