Skip to content
Permalink
Browse files

handle ogr sublayers with colon

  • Loading branch information
jef-n committed Jun 24, 2015
1 parent 048aff0 commit 2b703e397cd7ce8d4d3fd3fbb01934e8b437aad8
Showing with 35 additions and 3 deletions.
  1. +22 −2 src/app/qgisapp.cpp
  2. +13 −1 src/gui/qgssublayersdialog.cpp
@@ -2995,7 +2995,15 @@ bool QgisApp::addVectorLayers( const QStringList &theLayerQStringList, const QSt
QStringList sublayers = layer->dataProvider()->subLayers();
QStringList elements = sublayers.at( 0 ).split( ":" );
if ( layer->storageType() != "GeoJSON" )
{
while ( elements.size() > 4 )
{
elements[1] += ":" + elements[2];
elements.removeAt( 2 );
}

layer->setLayerName( elements.at( 1 ) );
}
myList << layer;
}
else
@@ -3320,8 +3328,20 @@ void QgisApp::loadOGRSublayers( QString layertype, QString uri, QStringList list
for ( int i = 0; i < list.size(); i++ )
{
QString composedURI;
QString layerName = list.at( i ).split( ':' ).value( 0 );
QString layerType = list.at( i ).split( ':' ).value( 1 );
QStringList elements = list.at( i ).split( ":" );
while ( elements.size() > 2 )
{
elements[0] += ":" + elements[1];
elements.removeAt( 1 );
}

QString layerName = elements.value( 0 );
QString layerType = elements.value( 1 );
if ( layerType == "any" )
{
layerType = "";
list.removeAt( 1 );
}

if ( layertype != "GRASS" )
{
@@ -81,10 +81,16 @@ QStringList QgsSublayersDialog::selectionNames()
count++;
}
}

if ( count > 1 )
{
name += ":" + layersTable->selectedItems().at( i )->text( 3 );
}
else
{
name += ":any";
}

list << name;
}
return list;
@@ -104,7 +110,13 @@ void QgsSublayersDialog::populateLayerTable( QStringList theList, QString delim
{
foreach ( QString item, theList )
{
layersTable->addTopLevelItem( new QTreeWidgetItem( item.split( delim ) ) );
QStringList elements = item.split( delim );
while ( elements.size() > 4 )
{
elements[1] += delim + elements[2];
elements.removeAt( 2 );
}
layersTable->addTopLevelItem( new QTreeWidgetItem( elements ) );
}

// resize columns

2 comments on commit 2b703e3

@m-kuhn

This comment has been minimized.

Copy link
Member

@m-kuhn m-kuhn replied Jun 25, 2015

(I assume) this commit makes QGIS crash at

QString name = list.at( i );
when loading http://download.geofabrik.de/north-america/greenland-latest.osm.pbf

@jef-n

This comment has been minimized.

Copy link
Member Author

@jef-n jef-n replied Jun 25, 2015

fixed in d875011

Please sign in to comment.
You can’t perform that action at this time.