Skip to content

Commit

Permalink
do not search for less than 3 letters
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Feb 5, 2018
1 parent c6840bd commit 058d59b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/gui/qgsoptionsdialogbase.cpp
Expand Up @@ -207,6 +207,8 @@ void QgsOptionsDialogBase::restoreOptionsBaseUi( const QString &title )

void QgsOptionsDialogBase::searchText( const QString &text )
{
const int minimumTextLength = 3;

mSearchLineEdit->setMinimumWidth( text.isEmpty() ? 0 : 70 );

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

for ( const QPair< QgsOptionsDialogHighlightWidget *, int > &rsw : qgis::as_const( mRegisteredSearchWidgets ) )
{
if ( rsw.first->searchHighlight( text ) )
if ( rsw.first->searchHighlight( text.length() >= minimumTextLength ? text : QString() ) )
{
mOptListWidget->setRowHidden( rsw.second, false );
}
Expand Down

0 comments on commit 058d59b

Please sign in to comment.