File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,13 @@ QgsMapLayer::QgsMapLayer(int type,
73
73
// Generate the unique ID of this layer
74
74
QDateTime dt = QDateTime::currentDateTime ();
75
75
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]" ), " _" );
77
83
78
84
QString myThemePath = QgsApplication::themePath ();
79
85
mInOverviewPixmap .load (myThemePath + " /mActionInOverview.png" );
You can’t perform that action at this time.
0 commit comments