Skip to content

Commit

Permalink
incremental wild card searching done
Browse files Browse the repository at this point in the history
  • Loading branch information
Arunmozhi committed Jul 9, 2012
1 parent 08b40d8 commit b5ffa14
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/symbology-ng/qgsstylev2.cpp
Expand Up @@ -596,7 +596,7 @@ QStringList QgsStyleV2::findSymbols( QString qword )
{
QByteArray array = qword.toUtf8();
char *query;
query = sqlite3_mprintf( "SELECT name FROM symbol WHERE xml LIKE '\%%q\%'", array.constData() );
query = sqlite3_mprintf( "SELECT name FROM symbol WHERE xml LIKE '%%%q%%';", array.constData() );

QStringList symbols;
sqlite3 *db = openDB( mFileName );
Expand Down
8 changes: 7 additions & 1 deletion src/gui/symbology-ng/qgsstylev2managerdialog.cpp
Expand Up @@ -44,7 +44,6 @@
QgsStyleV2ManagerDialog::QgsStyleV2ManagerDialog( QgsStyleV2* style, QWidget* parent )
: QDialog( parent ), mStyle( style ), mModified( false )
{

setupUi( this );

QSettings settings;
Expand Down Expand Up @@ -105,6 +104,8 @@ QgsStyleV2ManagerDialog::QgsStyleV2ManagerDialog( QgsStyleV2* style, QWidget* pa
connect( tabItemType, SIGNAL( currentChanged( int ) ), this, SLOT( populateList() ) );
populateList();

connect( searchBox, SIGNAL( textChanged( QString ) ), this, SLOT( filterSymbols( QString ) ) );

}

void QgsStyleV2ManagerDialog::onFinished()
Expand Down Expand Up @@ -955,3 +956,8 @@ void QgsStyleV2ManagerDialog::tagSymbolsAction()
QgsDebugMsg( "tagging symbols now" );
}

void QgsStyleV2ManagerDialog::filterSymbols( QString qword )
{
QStringList symbols = mStyle->findSymbols( qword );
populateSymbols( symbols );
}
3 changes: 3 additions & 0 deletions src/gui/symbology-ng/qgsstylev2managerdialog.h
Expand Up @@ -60,6 +60,9 @@ class GUI_EXPORT QgsStyleV2ManagerDialog : public QDialog, private Ui::QgsStyleV
void tagSymbolsAction();
void regrouped( QStandardItem* );

//! filter the symbols based on input search term
void filterSymbols( QString );

protected:

//! populate combo box with known style items (symbols, color ramps)
Expand Down

0 comments on commit b5ffa14

Please sign in to comment.