core: don't show " at " in qml warnings if object name is empty

This commit is contained in:
outfoxxed 2025-05-26 17:31:07 -07:00
parent ee31e5d226
commit b898592db7
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E

View file

@ -327,13 +327,13 @@ void EngineGeneration::onEngineWarnings(const QList<QQmlError>& warnings) const
QString objectName;
auto desc = error.description();
if (auto i = desc.indexOf(": "); i != -1) {
objectName = desc.first(i);
if (auto i = desc.indexOf(": "); i != -1 && desc.startsWith("QML ")) {
objectName = desc.first(i) + " at ";
desc = desc.sliced(i + 2);
}
qCWarning(logScene).noquote().nospace() << objectName << " at " << rel << '[' << error.line()
<< ':' << error.column() << "]: " << desc;
qCWarning(logScene).noquote().nospace()
<< objectName << rel << '[' << error.line() << ':' << error.column() << "]: " << desc;
}
}