[QGIS Commit] r10605 - trunk/qgis/src/core
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Mon Apr 20 15:29:56 EDT 2009
Author: jef
Date: 2009-04-20 15:29:55 -0400 (Mon, 20 Apr 2009)
New Revision: 10605
Modified:
trunk/qgis/src/core/qgsvectorlayer.cpp
Log:
fix #1644
Modified: trunk/qgis/src/core/qgsvectorlayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.cpp 2009-04-20 09:43:49 UTC (rev 10604)
+++ trunk/qgis/src/core/qgsvectorlayer.cpp 2009-04-20 19:29:55 UTC (rev 10605)
@@ -2188,11 +2188,11 @@
// adjust the display name for postgres layers
QRegExp reg( "\"[^\"]+\"\\.\"([^\"]+)\" \\(([^)]+)\\)" );
- reg.indexIn( name() );
- QStringList stuff = reg.capturedTexts();
- QString lName = stuff[1];
- if ( stuff.size() == 3 )
+ if ( reg.indexIn( name() ) >= 0 )
{
+ QStringList stuff = reg.capturedTexts();
+ QString lName = stuff[1];
+
const QMap<QString, QgsMapLayer*> &layers = QgsMapLayerRegistry::instance()->mapLayers();
QMap<QString, QgsMapLayer*>::const_iterator it;
@@ -2201,10 +2201,11 @@
if ( it != layers.constEnd() )
lName += "." + stuff[2];
+
+ if ( !lName.isEmpty() )
+ setLayerName( lName );
}
- else if ( lName.length() == 0 ) // fallback
- lName = name();
- setLayerName( lName );
+
QgsDebugMsg( "Beautifying layer name " + name() );
// deal with unnecessary schema qualification to make v.in.ogr happy
More information about the QGIS-commit
mailing list