forked from qt-creator/qt-creator
QmlDesigner: Include the ID in the invalid ID message
Change-Id: Ieacf36991cbe5e5f96cdc8dc26413cbbaec25608 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -165,7 +165,7 @@ void PropertyEditorView::changeValue(const QString &name)
|
||||
m_locked = false;
|
||||
QString errMsg = QmlDesigner::ModelNode::getIdValidityErrorMessage(newId);
|
||||
if (!errMsg.isEmpty())
|
||||
Core::AsynchronousMessageBox::warning(tr("Invalid ID"), errMsg.arg(newId));
|
||||
Core::AsynchronousMessageBox::warning(tr("Invalid ID"), errMsg);
|
||||
else
|
||||
Core::AsynchronousMessageBox::warning(tr("Invalid ID"), tr("%1 already exists.").arg(newId));
|
||||
}
|
||||
|
@@ -218,21 +218,21 @@ QString ModelNode::getIdValidityErrorMessage(const QString &id)
|
||||
return {}; // valid
|
||||
|
||||
if (id.at(0).isUpper())
|
||||
return QObject::tr("ID cannot start with an uppercase character.");
|
||||
return QObject::tr("ID cannot start with an uppercase character (%1).").arg(id);
|
||||
|
||||
if (id.at(0).isDigit())
|
||||
return QObject::tr("ID cannot start with a number.");
|
||||
return QObject::tr("ID cannot start with a number (%1).").arg(id);
|
||||
|
||||
if (id.contains(' '))
|
||||
return QObject::tr("ID cannot include whitespace.");
|
||||
return QObject::tr("ID cannot include whitespace (%1).").arg(id);
|
||||
|
||||
if (idIsQmlKeyWord(id))
|
||||
return QObject::tr("%1 is a reserved QML keyword.");
|
||||
return QObject::tr("%1 is a reserved QML keyword.").arg(id);
|
||||
|
||||
if (isIdToAvoid(id))
|
||||
return QObject::tr("%1 is a reserved property keyword.");
|
||||
return QObject::tr("%1 is a reserved property keyword.").arg(id);
|
||||
|
||||
return QObject::tr("ID includes invalid characters.");
|
||||
return QObject::tr("ID includes invalid characters (%1).").arg(id);
|
||||
}
|
||||
|
||||
bool ModelNode::hasId() const
|
||||
|
Reference in New Issue
Block a user