Skip to content
Permalink
Browse files
Allow usage of search query builder with no layer, fixed python binding
git-svn-id: http://svn.osgeo.org/qgis/trunk@14869 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Dec 8, 2010
1 parent de03684 commit b85805639eb0f5d9b78d081812c3fc09b93c995b
Showing with 9 additions and 2 deletions.
  1. +1 −1 python/gui/qgssearchquerybuilder.sip
  2. +8 −1 src/gui/qgssearchquerybuilder.cpp
@@ -5,7 +5,7 @@ class QgsSearchQueryBuilder : QDialog
%End

public:
QgsSearchQueryBuilder( QgsVectorLayer* layer, QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDialogFlags );
QgsSearchQueryBuilder( QgsVectorLayer* layer, QWidget *parent /TransferThis/ = 0, Qt::WFlags fl = QgisGui::ModalDialogFlags );
~QgsSearchQueryBuilder();

//! returns newly created search string
@@ -60,7 +60,8 @@ QgsSearchQueryBuilder::QgsSearchQueryBuilder( QgsVectorLayer* layer,
pbn->setToolTip( tr( "Load query from xml file" ) );
connect( pbn, SIGNAL( clicked() ), this, SLOT( loadQuery() ) );

lblDataUri->setText( layer->name() );
if ( layer )
lblDataUri->setText( layer->name() );
populateFields();
}

@@ -71,6 +72,9 @@ QgsSearchQueryBuilder::~QgsSearchQueryBuilder()

void QgsSearchQueryBuilder::populateFields()
{
if ( !mLayer )
return;

QgsDebugMsg( "entering." );
QRegExp reQuote( "[A-Za-z_][A-Za-z0-9_]*" );
const QgsFieldMap& fields = mLayer->pendingFields();
@@ -195,6 +199,9 @@ long QgsSearchQueryBuilder::countRecords( QString searchString )
return -1;
}

if ( !mLayer )
return -1;

QgsSearchTreeNode* searchTree = search.tree();
if ( searchTree == NULL )
{

0 comments on commit b858056

Please sign in to comment.