Skip to content

Commit bdcca91

Browse files
author
jef
committedOct 25, 2010
fix #3153
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14433 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed
 

‎src/app/postgres/qgspgsourceselect.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,10 @@ void QgsPgSourceSelect::setSql( const QModelIndex &index )
548548
return;
549549
}
550550

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

553556
if ( !vlayer->isValid() )
554557
{

‎src/app/qgsquerybuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ QgsQueryBuilder::QgsQueryBuilder( QgsVectorLayer *layer,
4444

4545
mOrigSubsetString = layer->subsetString();
4646

47-
lblDataUri->setText( layer->publicSource() );
47+
lblDataUri->setText( layer->name() );
4848
txtSQL->setText( mOrigSubsetString );
4949

5050
populateFields();

‎src/core/qgsvectorlayer.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4150,8 +4150,15 @@ void QgsVectorLayer::setCoordinateSystem()
41504150
//we only nee to do that if the srs is not alreay valid
41514151
if ( !mCRS->isValid() )
41524152
{
4153-
mCRS->setValidationHint( tr( "Specify CRS for layer %1" ).arg( name() ) );
4154-
mCRS->validate();
4153+
if ( geometryType() != QGis::NoGeometry )
4154+
{
4155+
mCRS->setValidationHint( tr( "Specify CRS for layer %1" ).arg( name() ) );
4156+
mCRS->validate();
4157+
}
4158+
else
4159+
{
4160+
mCRS->createFromProj4( GEOPROJ4 );
4161+
}
41554162
}
41564163
}
41574164

0 commit comments

Comments
 (0)
Please sign in to comment.