From 9985cc330adb2af1b601e8a77ff5f9b485729577 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 10 Jun 2020 16:01:22 +0200 Subject: uic: use C string literals for setObjectName() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because setObjectName() now takes a QAnyStringView, passing C string literals is much more efficient than using QString::fromUtf8(). This patch only deals with setObjectName() as a known property, probably from a name attribute. If the objectName property is set by a element (or so I assume), we still emit a QString::fromUtf8(). Detecting objectName there would be too much magic. Besides, I haven't been able to find why sometimes there's a second setObjectName call right after the first, when in the XML it seems all kosher (name attribute and objectName agreeing on the content). Change-Id: Icf07bad841ac735a9c744bbd955428ba15758089 Reviewed-by: Thiago Macieira Reviewed-by: Qt CI Bot Reviewed-by: Friedemann Kleint Reviewed-by: MÃ¥rten Nordheim --- src/tools/uic/cpp/cppwriteinitialization.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tools/uic/cpp/cppwriteinitialization.cpp') diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 7f5776b5c64..33aa48d3087 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -1218,7 +1218,7 @@ void WriteInitialization::writeProperties(const QString &varName, objectName.remove(0, language::self.size()); m_output << m_indent << indent << varName << language::derefPointer << "setObjectName(" - << language::qstring(objectName, m_dindent) << ')' << language::eol; + << language::charliteral(objectName, m_dindent) << ')' << language::eol; } int leftMargin, topMargin, rightMargin, bottomMargin; -- cgit v1.2.3