File tree 1 file changed +8
-7
lines changed
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -2188,11 +2188,11 @@ bool QgsVectorLayer::setDataProvider( QString const & provider )
2188
2188
2189
2189
// adjust the display name for postgres layers
2190
2190
QRegExp reg ( " \" [^\" ]+\"\\ .\" ([^\" ]+)\" \\ (([^)]+)\\ )" );
2191
- reg.indexIn ( name () );
2192
- QStringList stuff = reg.capturedTexts ();
2193
- QString lName = stuff[1 ];
2194
- if ( stuff.size () == 3 )
2191
+ if ( reg.indexIn ( name () ) >= 0 )
2195
2192
{
2193
+ QStringList stuff = reg.capturedTexts ();
2194
+ QString lName = stuff[1 ];
2195
+
2196
2196
const QMap<QString, QgsMapLayer*> &layers = QgsMapLayerRegistry::instance ()->mapLayers ();
2197
2197
2198
2198
QMap<QString, QgsMapLayer*>::const_iterator it;
@@ -2201,10 +2201,11 @@ bool QgsVectorLayer::setDataProvider( QString const & provider )
2201
2201
2202
2202
if ( it != layers.constEnd () )
2203
2203
lName += " ." + stuff[2 ];
2204
+
2205
+ if ( !lName.isEmpty () )
2206
+ setLayerName ( lName );
2204
2207
}
2205
- else if ( lName.length () == 0 ) // fallback
2206
- lName = name ();
2207
- setLayerName ( lName );
2208
+
2208
2209
QgsDebugMsg ( " Beautifying layer name " + name () );
2209
2210
2210
2211
// deal with unnecessary schema qualification to make v.in.ogr happy
You can’t perform that action at this time.
0 commit comments