Skip to content

Commit

Permalink
also restore style for file based layers (followup dfff717) and
Browse files Browse the repository at this point in the history
use file name for GeoJSON layers (fixes #10711)
  • Loading branch information
jef-n committed Oct 30, 2014
1 parent dfff717 commit d941949
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2771,7 +2771,7 @@ bool QgisApp::addVectorLayers( const QStringList &theLayerQStringList, const QSt

// create the layer

QgsVectorLayer *layer = new QgsVectorLayer( src, base, "ogr" );
QgsVectorLayer *layer = new QgsVectorLayer( src, base, "ogr", false );
Q_CHECK_PTR( layer );

if ( ! layer )
Expand Down Expand Up @@ -2807,9 +2807,9 @@ bool QgisApp::addVectorLayers( const QStringList &theLayerQStringList, const QSt
{
//set friendly name for datasources with only one layer
QStringList sublayers = layer->dataProvider()->subLayers();
QString ligne = sublayers.at( 0 );
QStringList elements = ligne.split( ":" );
layer->setLayerName( elements.at( 1 ) );
QStringList elements = sublayers.at( 0 ).split( ":" );
if ( layer->storageType() != "GeoJSON" )
layer->setLayerName( elements.at( 1 ) );
myList << layer;
}
else
Expand Down Expand Up @@ -2838,6 +2838,11 @@ bool QgisApp::addVectorLayers( const QStringList &theLayerQStringList, const QSt

// Register this layer with the layers registry
QgsMapLayerRegistry::instance()->addMapLayers( myList );
foreach ( QgsMapLayer *l, myList )
{
bool ok;
l->loadDefaultStyle( ok );
}

// Only update the map if we frozen in this method
// Let the caller do it otherwise
Expand Down Expand Up @@ -3163,10 +3168,10 @@ void QgisApp::loadOGRSublayers( QString layertype, QString uri, QStringList list
{
// Register layer(s) with the layers registry
QgsMapLayerRegistry::instance()->addMapLayers( myList );
foreach( QgsMapLayer *l, myList )
foreach ( QgsMapLayer *l, myList )
{
bool ok;
l->loadDefaultStyle(ok);
l->loadDefaultStyle( ok );
}
}
}
Expand Down

0 comments on commit d941949

Please sign in to comment.