[QGIS Commit] r14869 - in trunk/qgis: python/gui src/gui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Dec 8 13:29:24 EST 2010


Author: wonder
Date: 2010-12-08 10:29:24 -0800 (Wed, 08 Dec 2010)
New Revision: 14869

Modified:
   trunk/qgis/python/gui/qgssearchquerybuilder.sip
   trunk/qgis/src/gui/qgssearchquerybuilder.cpp
Log:
Allow usage of search query builder with no layer, fixed python binding


Modified: trunk/qgis/python/gui/qgssearchquerybuilder.sip
===================================================================
--- trunk/qgis/python/gui/qgssearchquerybuilder.sip	2010-12-08 17:41:05 UTC (rev 14868)
+++ trunk/qgis/python/gui/qgssearchquerybuilder.sip	2010-12-08 18:29:24 UTC (rev 14869)
@@ -5,7 +5,7 @@
 %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

Modified: trunk/qgis/src/gui/qgssearchquerybuilder.cpp
===================================================================
--- trunk/qgis/src/gui/qgssearchquerybuilder.cpp	2010-12-08 17:41:05 UTC (rev 14868)
+++ trunk/qgis/src/gui/qgssearchquerybuilder.cpp	2010-12-08 18:29:24 UTC (rev 14869)
@@ -60,7 +60,8 @@
   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 @@
 
 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 @@
     return -1;
   }
 
+  if ( !mLayer )
+    return -1;
+
   QgsSearchTreeNode* searchTree = search.tree();
   if ( searchTree == NULL )
   {



More information about the QGIS-commit mailing list