We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 66ef358 commit 8de53bdCopy full SHA for 8de53bd
src/gui/qgsmaplayer.cpp
@@ -73,7 +73,13 @@ QgsMapLayer::QgsMapLayer(int type,
73
// Generate the unique ID of this layer
74
QDateTime dt = QDateTime::currentDateTime();
75
ID = lyrname + dt.toString("yyyyMMddhhmmsszzz");
76
- ID.replace(" ", "_");
+ // 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]"), "_");
83
84
QString myThemePath = QgsApplication::themePath();
85
mInOverviewPixmap.load(myThemePath + "/mActionInOverview.png");
0 commit comments