From 34b48cd4f7fed202fffca08b5943eb82cf335b74 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Fri, 27 Jan 2023 14:25:59 +0100 Subject: Support QT_NO_CAST_FROM_ASCII in generated code This is needed as the generated code will be included in targets with possibly QT_NO_CAST_FROM_ASCII set. Change-Id: Ic71e729657fbe2c0c402c86439e633cf6102e358 Reviewed-by: Brett Stottlemyer --- tools/repc/repcodegenerator.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'tools') diff --git a/tools/repc/repcodegenerator.cpp b/tools/repc/repcodegenerator.cpp index ed61d67..d544268 100644 --- a/tools/repc/repcodegenerator.cpp +++ b/tools/repc/repcodegenerator.cpp @@ -269,6 +269,9 @@ void RepCodeGenerator::generateHeader(Mode mode) m_stream << m_ast.preprocessorDirectives.join(QLatin1Char('\n')); m_stream << "\n"; + + m_stream << "using namespace Qt::Literals::StringLiterals;"; + m_stream << "\n"; } static QString formatTemplateStringArgTypeNameCapitalizedName(int numberOfTypeOccurrences, @@ -664,13 +667,13 @@ void RepCodeGenerator::generateClass(Mode mode, const ASTClass &astClass, if (astClass.subClassPropertyIndices.contains(index)) m_stream << QString::fromLatin1(" setChild(%1, QVariant::fromValue(" "node->acquire<%2Replica>(QRemoteObjectStringLiterals::CLASS()" - ".arg(\"%3\"))));") + ".arg(u\"%3\"_s))));") .arg(QString::number(index), property.type, acquireName) << Qt::endl; else m_stream << QString::fromLatin1(" setChild(%1, QVariant::fromValue(" "node->acquireModel(QRemoteObjectStringLiterals::MODEL()" - ".arg(\"%2\"))));") + ".arg(u\"%2\"_s))));") .arg(QString::number(index), acquireName) << Qt::endl; m_stream << " Q_EMIT " << property.name << "Changed(" << property.name << "()" << ");" << Qt::endl; @@ -693,12 +696,12 @@ void RepCodeGenerator::generateClass(Mode mode, const ASTClass &astClass, if (astClass.subClassPropertyIndices.contains(index)) m_stream << QString::fromLatin1(" setChild(%1, QVariant::fromValue(" "node->acquire<%2Replica>(QRemoteObjectStringLiterals::CLASS()" - ".arg(\"%3\"))));") + ".arg(u\"%3\"_s))));") .arg(QString::number(index), property.type, acquireName) << Qt::endl; else m_stream << QString::fromLatin1(" setChild(%1, QVariant::fromValue(" "node->acquireModel(QRemoteObjectStringLiterals::MODEL()" - ".arg(\"%2\"))));") + ".arg(u\"%2\"_s))));") .arg(QString::number(index), acquireName) << Qt::endl; } m_stream << " }" << Qt::endl; -- cgit v1.2.3