Skip to content

Commit 058d59b

Browse files
committed
do not search for less than 3 letters
1 parent c6840bd commit 058d59b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/gui/qgsoptionsdialogbase.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ void QgsOptionsDialogBase::restoreOptionsBaseUi( const QString &title )
207207

208208
void QgsOptionsDialogBase::searchText( const QString &text )
209209
{
210+
const int minimumTextLength = 3;
211+
210212
mSearchLineEdit->setMinimumWidth( text.isEmpty() ? 0 : 70 );
211213

212214
if ( !mOptStackedWidget )
@@ -219,12 +221,12 @@ void QgsOptionsDialogBase::searchText( const QString &text )
219221
// hide all page if text has to be search, show them all otherwise
220222
for ( int r = 0; r < mOptListWidget->count(); ++r )
221223
{
222-
mOptListWidget->setRowHidden( r, !text.isEmpty() );
224+
mOptListWidget->setRowHidden( r, text.length() >= minimumTextLength );
223225
}
224226

225227
for ( const QPair< QgsOptionsDialogHighlightWidget *, int > &rsw : qgis::as_const( mRegisteredSearchWidgets ) )
226228
{
227-
if ( rsw.first->searchHighlight( text ) )
229+
if ( rsw.first->searchHighlight( text.length() >= minimumTextLength ? text : QString() ) )
228230
{
229231
mOptListWidget->setRowHidden( rsw.second, false );
230232
}

0 commit comments

Comments
 (0)