qtextdocument: replace fromLatin1 with L1 literal

to reduce allocations

Change-Id: Ie6f734269c9e880ff208629a625c88f4841e9533
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Anton Kudryavtsev 2023-10-04 14:53:30 +03:00
parent 33d606412d
commit 0ccb8ab1db

View File

@ -2374,11 +2374,14 @@ QString QTextHtmlExporter::toHtml(ExportMode mode)
fragmentMarkers = (mode == ExportFragment);
html += QString::fromLatin1("<meta charset=\"utf-8\" />");
html += "<meta charset=\"utf-8\" />"_L1;
QString title = doc->metaInformation(QTextDocument::DocumentTitle);
if (!title.isEmpty())
html += QString::fromLatin1("<title>") + title + QString::fromLatin1("</title>");
if (!title.isEmpty()) {
html += "<title>"_L1;
html += title;
html += "</title>"_L1;
}
html += "<style type=\"text/css\">\n"_L1;
html += "p, li { white-space: pre-wrap; }\n"_L1;
html += "hr { height: 1px; border-width: 0; }\n"_L1;
@ -3023,7 +3026,8 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block)
html += u'"';
}
QString styleString = QString::fromLatin1("margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;");
QString styleString;
styleString += "margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;"_L1;
if (format.hasProperty(QTextFormat::ListIndent)) {
styleString += " -qt-list-indent: "_L1;