Fix for ticket #226 (saved projects with postgres layers in a map composition won't reload).

git-svn-id: http://svn.osgeo.org/qgis/trunk@5730 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
g_j_m 2006-08-24 09:58:37 +00:00
parent 744f78f610
commit f880882db4

View File

@ -73,7 +73,13 @@ QgsMapLayer::QgsMapLayer(int type,
// Generate the unique ID of this layer
QDateTime dt = QDateTime::currentDateTime();
ID = lyrname + dt.toString("yyyyMMddhhmmsszzz");
ID.replace(" ", "_");
// Tidy the ID up to avoid characters that may cause problems
// elsewhere (e.g in some parts of XML). Replaces every non-word
// character (word characters are the alphabet, numbers and
// underscore) with an underscore.
// Note that the first backslashe in the regular expression is
// there for the compiler, so the pattern is actually \W
ID.replace(QRegExp("[\\W]"), "_");
QString myThemePath = QgsApplication::themePath();
mInOverviewPixmap.load(myThemePath + "/mActionInOverview.png");