forked from qt-creator/qt-creator
QmlDesigner: Fix image id generation for names starting with digit
Change-Id: I763e8b49d0b8dd3274bea79d61156321185706a5 Fixes: QDS-2759 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
committed by
Thomas Hartmann
parent
4690f7c914
commit
92f9502f56
@@ -516,8 +516,13 @@ QString AbstractView::generateNewId(const QString &prefixName, const QString &fa
|
|||||||
QString newBaseId = QString(QStringLiteral("%1")).arg(firstCharToLower(prefixName));
|
QString newBaseId = QString(QStringLiteral("%1")).arg(firstCharToLower(prefixName));
|
||||||
newBaseId.remove(QRegExp(QStringLiteral("[^a-zA-Z0-9_]")));
|
newBaseId.remove(QRegExp(QStringLiteral("[^a-zA-Z0-9_]")));
|
||||||
|
|
||||||
if (newBaseId.isEmpty())
|
if (!newBaseId.isEmpty()) {
|
||||||
|
QChar firstChar = newBaseId.at(0);
|
||||||
|
if (firstChar.isDigit())
|
||||||
|
newBaseId.prepend('_');
|
||||||
|
} else {
|
||||||
newBaseId = fallbackPrefix;
|
newBaseId = fallbackPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
QString newId = newBaseId;
|
QString newId = newBaseId;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user