File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -2550,7 +2550,7 @@ bool QgsVectorLayer::setDataProvider( QString const & provider )
2550
2550
QgsDebugMsg( "Beautifying layer name " + name() );
2551
2551
2552
2552
// adjust the display name for postgres layers
2553
- QRegExp reg( "\"[^\"]+\"\\.\"([^\"]+)\" \\(( [^)]+) \\)" );
2553
+ QRegExp reg( "\"[^\"]+\"\\.\"([^\"]+)\"( \\([^)]+\\))? " );
2554
2554
if ( reg.indexIn( name() ) >= 0 )
2555
2555
{
2556
2556
QStringList stuff = reg.capturedTexts();
@@ -2562,14 +2562,16 @@ bool QgsVectorLayer::setDataProvider( QString const & provider )
2562
2562
for ( it = layers.constBegin(); it != layers.constEnd() && ( *it )->name() != lName; it++ )
2563
2563
;
2564
2564
2565
- if ( it != layers.constEnd() )
2566
- lName += "." + stuff[2];
2565
+ if ( it != layers.constEnd() && stuff.size() > 2 )
2566
+ {
2567
+ lName += "." + stuff[2].mid( 2, stuff[2].length() - 3 );
2568
+ }
2567
2569
2568
2570
if ( !lName.isEmpty() )
2569
2571
setLayerName( lName );
2570
2572
}
2571
2573
2572
- QgsDebugMsg( "Beautifying layer name " + name() );
2574
+ QgsDebugMsg( "Beautified layer name " + name() );
2573
2575
2574
2576
// deal with unnecessary schema qualification to make v.in.ogr happy
2575
2577
mDataSource = mDataProvider->dataSourceUri();
You can’t perform that action at this time.
0 commit comments