Skip to content

Commit e9f245d

Browse files
author
timlinux
committed
Applied patch to close #25 - allow case insensitive search of attribute table
git-svn-id: http://svn.osgeo.org/qgis/trunk@14241 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent e6658a0 commit e9f245d

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

src/app/attributetable/qgsattributetabledialog.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -627,12 +627,16 @@ void QgsAttributeTableDialog::search()
627627
int fldIndex = mLayer->fieldNameIndex( fieldName );
628628
QVariant::Type fldType = flds[fldIndex].type();
629629
bool numeric = ( fldType == QVariant::Int || fldType == QVariant::Double );
630+
QString sensString = "ILIKE";
631+
if (cbxCaseSensitive->isChecked()) {
632+
sensString = "LIKE";
633+
}
630634

631635
QString str = QString( "%1 %2 '%3'" )
632636
.arg( QgsSearchTreeNode::quotedColumnRef( fieldName ) )
633-
.arg( numeric ? "=" : "~" )
634-
.arg( mQuery->displayText().replace( "'", "''" ) ); // escape quotes
635-
637+
.arg( numeric ? "=" : sensString )
638+
.arg( numeric ? mQuery->displayText().replace( "'", "''" ) :
639+
"%" + mQuery->displayText().replace ("'", "''") + "%" ); // escape quotes
636640
doSearch( str );
637641
}
638642

src/ui/qgsattributetabledialog.ui

+19-3
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,24 @@
2626
<item>
2727
<widget class="QCheckBox" name="cbxShowSelectedOnly">
2828
<property name="text">
29-
<string>Show selected records only</string>
29+
<string>Show selected only</string>
3030
</property>
3131
</widget>
3232
</item>
3333
<item>
3434
<widget class="QCheckBox" name="cbxSearchSelectedOnly">
3535
<property name="text">
36-
<string>Search selected records only</string>
36+
<string>Search selected only</string>
37+
</property>
38+
</widget>
39+
</item>
40+
<item>
41+
<widget class="QCheckBox" name="cbxCaseSensitive">
42+
<property name="text">
43+
<string>Case sensitive</string>
44+
</property>
45+
<property name="checked">
46+
<bool>true</bool>
3747
</property>
3848
</widget>
3949
</item>
@@ -68,8 +78,14 @@
6878
</item>
6979
<item>
7080
<widget class="QPushButton" name="mHelpButton">
81+
<property name="minimumSize">
82+
<size>
83+
<width>85</width>
84+
<height>0</height>
85+
</size>
86+
</property>
7187
<property name="text">
72-
<string>Help</string>
88+
<string>?</string>
7389
</property>
7490
</widget>
7591
</item>

0 commit comments

Comments
 (0)