Tools: replace QString::trimmed() with QStringRef::trimmed()
... where it's possible. Reduce allocations. Change-Id: I9908d9d65177d116a8a54146274a74edb801543e Reviewed-by: Marc Mutz <marc.mutz@kdab.com>bb10
parent
5392259ce6
commit
3a33ee78c9
|
|
@ -291,9 +291,8 @@ void WriteIncludes::writeHeaders(const OrderedSet &headers, bool global)
|
|||
const StringMap::const_iterator hit = m_oldHeaderToNewHeader.constFind(sit.key());
|
||||
const bool mapped = hit != m_oldHeaderToNewHeader.constEnd();
|
||||
const QString header = mapped ? hit.value() : sit.key();
|
||||
if (!header.trimmed().isEmpty()) {
|
||||
if (!QStringRef(&header).trimmed().isEmpty())
|
||||
m_output << "#include " << openingQuote << header << closingQuote << QLatin1Char('\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2473,10 +2473,8 @@ void WriteInitialization::acceptWidgetScripts(const DomScripts &widgetScripts, D
|
|||
QString script;
|
||||
for (const DomScript *domScript : qAsConst(scripts)) {
|
||||
const QString snippet = domScript->text();
|
||||
if (!snippet.isEmpty()) {
|
||||
script += snippet.trimmed();
|
||||
script += QLatin1Char('\n');
|
||||
}
|
||||
if (!snippet.isEmpty())
|
||||
script += QStringRef(&snippet).trimmed() + QLatin1Char('\n');
|
||||
}
|
||||
if (script.isEmpty())
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue