Skip to content
Permalink
Browse files
Applied patch to close #25 - allow case insensitive search of attribu…
…te table

git-svn-id: http://svn.osgeo.org/qgis/trunk@14241 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Sep 16, 2010
1 parent e6658a0 commit e9f245d8182bd84ba3ad0ede1f92cad26ee717d9
Showing with 26 additions and 6 deletions.
  1. +7 −3 src/app/attributetable/qgsattributetabledialog.cpp
  2. +19 −3 src/ui/qgsattributetabledialog.ui
@@ -627,12 +627,16 @@ void QgsAttributeTableDialog::search()
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 );
}

@@ -26,14 +26,24 @@
<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>
@@ -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>

0 comments on commit e9f245d

Please sign in to comment.