Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix #3153
git-svn-id: http://svn.osgeo.org/qgis/trunk@14433 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Oct 25, 2010
1 parent 9c256d3 commit 5cb3ae7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/app/postgres/qgspgsourceselect.cpp
Expand Up @@ -548,7 +548,10 @@ void QgsPgSourceSelect::setSql( const QModelIndex &index )
return;
}

QgsVectorLayer *vlayer = new QgsVectorLayer( layerURI( mProxyModel.mapToSource( index ) ), "querybuilder", "postgres" );
QModelIndex idx = mProxyModel.mapToSource( index );
QString tableName = mTableModel.itemFromIndex( idx.sibling( idx.row(), QgsDbTableModel::dbtmTable ) )->text();

QgsVectorLayer *vlayer = new QgsVectorLayer( layerURI( idx ), tableName, "postgres" );

if ( !vlayer->isValid() )
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsquerybuilder.cpp
Expand Up @@ -44,7 +44,7 @@ QgsQueryBuilder::QgsQueryBuilder( QgsVectorLayer *layer,

mOrigSubsetString = layer->subsetString();

lblDataUri->setText( layer->publicSource() );
lblDataUri->setText( layer->name() );
txtSQL->setText( mOrigSubsetString );

populateFields();
Expand Down
11 changes: 9 additions & 2 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -4150,8 +4150,15 @@ void QgsVectorLayer::setCoordinateSystem()
//we only nee to do that if the srs is not alreay valid
if ( !mCRS->isValid() )
{
mCRS->setValidationHint( tr( "Specify CRS for layer %1" ).arg( name() ) );
mCRS->validate();
if ( geometryType() != QGis::NoGeometry )
{
mCRS->setValidationHint( tr( "Specify CRS for layer %1" ).arg( name() ) );
mCRS->validate();
}
else
{
mCRS->createFromProj4( GEOPROJ4 );
}
}
}

Expand Down

0 comments on commit 5cb3ae7

Please sign in to comment.