Skip to content

Commit 8de53bd

Browse files
author
g_j_m
committed
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/qgis@5730 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 66ef358 commit 8de53bd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/gui/qgsmaplayer.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ QgsMapLayer::QgsMapLayer(int type,
7373
// Generate the unique ID of this layer
7474
QDateTime dt = QDateTime::currentDateTime();
7575
ID = lyrname + dt.toString("yyyyMMddhhmmsszzz");
76-
ID.replace(" ", "_");
76+
// Tidy the ID up to avoid characters that may cause problems
77+
// elsewhere (e.g in some parts of XML). Replaces every non-word
78+
// character (word characters are the alphabet, numbers and
79+
// underscore) with an underscore.
80+
// Note that the first backslashe in the regular expression is
81+
// there for the compiler, so the pattern is actually \W
82+
ID.replace(QRegExp("[\\W]"), "_");
7783

7884
QString myThemePath = QgsApplication::themePath();
7985
mInOverviewPixmap.load(myThemePath + "/mActionInOverview.png");

0 commit comments

Comments
 (0)