diff options
| author | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-03-21 10:21:18 +0100 |
|---|---|---|
| committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-04-29 09:47:43 +0200 |
| commit | 2c9c1590e6c9dc59bd786f4b41af32f1994bed2d (patch) | |
| tree | 7cc1302426732093f1c88c1d7621a95854ade0e2 /src/qmlcompiler/qqmljsfunctioninitializer.cpp | |
| parent | ecc87ea07723998dcfa947353e4259ec8d057035 (diff) | |
Replace uses of deprecated _qs with _s/QStringLiteral
Task-number: QTBUG-101408
Change-Id: Ic925751b73f52d8fa5add5cacc52d6dd6ea2dc27
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsfunctioninitializer.cpp')
| -rw-r--r-- | src/qmlcompiler/qqmljsfunctioninitializer.cpp | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/src/qmlcompiler/qqmljsfunctioninitializer.cpp b/src/qmlcompiler/qqmljsfunctioninitializer.cpp index ce8df3148f..56a2be53b7 100644 --- a/src/qmlcompiler/qqmljsfunctioninitializer.cpp +++ b/src/qmlcompiler/qqmljsfunctioninitializer.cpp @@ -35,6 +35,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + /*! * \internal * \class QQmlJSFunctionInitializer @@ -48,30 +50,30 @@ static QString bindingTypeDescription(QmlIR::Binding::ValueType type) { switch (type) { case QmlIR::Binding::Type_Invalid: - return u"invalid"_qs; + return u"invalid"_s; case QmlIR::Binding::Type_Boolean: - return u"a boolean"_qs; + return u"a boolean"_s; case QmlIR::Binding::Type_Number: - return u"a number"_qs; + return u"a number"_s; case QmlIR::Binding::Type_String: - return u"a string"_qs; + return u"a string"_s; case QmlIR::Binding::Type_Null: - return u"null"_qs; + return u"null"_s; case QmlIR::Binding::Type_Translation: - return u"a translation"_qs; + return u"a translation"_s; case QmlIR::Binding::Type_TranslationById: - return u"a translation by id"_qs; + return u"a translation by id"_s; case QmlIR::Binding::Type_Script: - return u"a script"_qs; + return u"a script"_s; case QmlIR::Binding::Type_Object: - return u"an object"_qs; + return u"an object"_s; case QmlIR::Binding::Type_AttachedProperty: - return u"an attached property"_qs; + return u"an attached property"_s; case QmlIR::Binding::Type_GroupProperty: - return u"a grouped property"_qs; + return u"a grouped property"_s; } - return u"nothing"_qs; + return u"nothing"_s; } void QQmlJSFunctionInitializer::populateSignature( @@ -99,14 +101,14 @@ void QQmlJSFunctionInitializer::populateSignature( function->argumentTypes.append( m_typeResolver->tracked( m_typeResolver->globalType(m_typeResolver->varType()))); - signatureError(u"Cannot resolve the argument type %1."_qs + signatureError(u"Cannot resolve the argument type %1."_s .arg(argument.typeAnnotation->type->toString())); } } else { function->argumentTypes.append( m_typeResolver->tracked( m_typeResolver->globalType(m_typeResolver->varType()))); - signatureError(u"Functions without type annotations won't be compiled"_qs); + signatureError(u"Functions without type annotations won't be compiled"_s); } } } @@ -115,7 +117,7 @@ void QQmlJSFunctionInitializer::populateSignature( if (ast->typeAnnotation) { function->returnType = m_typeResolver->typeFromAST(ast->typeAnnotation->type); if (!function->returnType) - signatureError(u"Cannot resolve return type %1"_qs.arg( + signatureError(u"Cannot resolve return type %1"_s.arg( QmlIR::IRBuilder::asString(ast->typeAnnotation->type->typeId))); } } @@ -149,7 +151,7 @@ QQmlJSCompilePass::Function QQmlJSFunctionInitializer::run( function.qmlScope = m_scopeType; if (irBinding.type != QmlIR::Binding::Type_Script) { - diagnose(u"Binding is not a script binding, but %1."_qs.arg( + diagnose(u"Binding is not a script binding, but %1."_s.arg( bindingTypeDescription(QmlIR::Binding::ValueType(quint32(irBinding.type)))), QtDebugMsg, bindingLocation, error); } @@ -158,7 +160,7 @@ QQmlJSCompilePass::Function QQmlJSFunctionInitializer::run( if (!isProperty && QmlIR::IRBuilder::isSignalPropertyName(propertyName)) { const QString signalName = QmlIR::IRBuilder::signalNameFromSignalPropertyName(propertyName); - if (signalName.endsWith(u"Changed"_qs) + if (signalName.endsWith(u"Changed"_s) && m_objectType->hasProperty(signalName.chopped(strlen("Changed")))) { function.isSignalHandler = true; } else { @@ -172,7 +174,7 @@ QQmlJSCompilePass::Function QQmlJSFunctionInitializer::run( } if (!function.isSignalHandler) { - diagnose(u"Could not compile signal handler for %1: The signal does not exist"_qs.arg( + diagnose(u"Could not compile signal handler for %1: The signal does not exist"_s.arg( signalName), QtWarningMsg, bindingLocation, error); } @@ -181,7 +183,7 @@ QQmlJSCompilePass::Function QQmlJSFunctionInitializer::run( if (!function.isSignalHandler) { if (!isProperty) { - diagnose(u"Could not compile binding for %1: The property does not exist"_qs.arg( + diagnose(u"Could not compile binding for %1: The property does not exist"_s.arg( propertyName), QtWarningMsg, bindingLocation, error); } @@ -193,7 +195,7 @@ QQmlJSCompilePass::Function QQmlJSFunctionInitializer::run( if (!function.returnType) { - diagnose(u"Cannot resolve property type %1 for binding on %2"_qs.arg( + diagnose(u"Cannot resolve property type %1 for binding on %2"_s.arg( property.typeName(), propertyName), QtWarningMsg, bindingLocation, error); } @@ -216,7 +218,7 @@ QQmlJSCompilePass::Function QQmlJSFunctionInitializer::run( auto body = new (&pool) QQmlJS::AST::StatementList(stmt); body = body->finish(); - QString name = u"binding for "_qs; // #### + QString name = u"binding for "_s; // #### ast = new (&pool) QQmlJS::AST::FunctionDeclaration( pool.newString(name), /*formals*/ nullptr, body); ast->lbraceToken = astNode->firstSourceLocation(); |
