Skip to content
Permalink
Browse files

handle ogr sublayers with colon

(cherry picked from commit 2b703e3 & d875011)
  • Loading branch information
jef-n committed Jun 24, 2015
1 parent 2a066d8 commit 5bdaf44718ba0e005f8583de3340c0802905e3a5
Showing with 35 additions and 3 deletions.
  1. +22 −2 src/app/qgisapp.cpp
  2. +13 −1 src/gui/qgssublayersdialog.cpp
@@ -2929,7 +2929,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
@@ -3254,8 +3262,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 = "";
elements.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

0 comments on commit 5bdaf44

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