aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/util/qdeclarativelistmodel.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp10
2 files changed, 12 insertions, 2 deletions
diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp
index 2b113abbec..3add850570 100644
--- a/src/declarative/util/qdeclarativelistmodel.cpp
+++ b/src/declarative/util/qdeclarativelistmodel.cpp
@@ -847,11 +847,11 @@ bool QDeclarativeListModelParser::compileProperty(const QDeclarativeCustomParser
AST::StringLiteral *literal = 0;
if (AST::CallExpression *callExpr = AST::cast<AST::CallExpression *>(node)) {
if (AST::IdentifierExpression *idExpr = AST::cast<AST::IdentifierExpression *>(callExpr->base)) {
- if (idExpr->name == QLatin1String("QT_TR_NOOP")) {
+ if (idExpr->name == QLatin1String("QT_TR_NOOP") || idExpr->name == QLatin1String("QT_TRID_NOOP")) {
if (callExpr->arguments && !callExpr->arguments->next)
literal = AST::cast<AST::StringLiteral *>(callExpr->arguments->expression);
if (!literal) {
- error(prop, QDeclarativeListModel::tr("ListElement: improperly specified QT_TR_NOOP"));
+ error(prop, QDeclarativeListModel::tr("ListElement: improperly specified %1").arg(idExpr->name.toString()));
return false;
}
} else if (idExpr->name == QLatin1String("QT_TRANSLATE_NOOP")) {
diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
index 946a3a5692..0c3b75ac98 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
@@ -219,6 +219,11 @@ void tst_qdeclarativelistmodel::static_i18n_data()
<< QVariant(QString("hello"))
<< QString();
+ QTest::newRow("QT_TRID_NOOP")
+ << QString::fromUtf8("ListElement { foo: QT_TRID_NOOP(\"qtn_1st_text\") }")
+ << QVariant(QString("qtn_1st_text"))
+ << QString();
+
QTest::newRow("QT_TR_NOOP extra param")
<< QString::fromUtf8("ListElement { foo: QT_TR_NOOP(\"hello\",\"world\") }")
<< QVariant(QString())
@@ -228,6 +233,11 @@ void tst_qdeclarativelistmodel::static_i18n_data()
<< "ListElement { foo: QT_TRANSLATE_NOOP() }"
<< QVariant(QString())
<< QString("ListElement: improperly specified QT_TRANSLATE_NOOP");
+
+ QTest::newRow("QT_TRID_NOOP missing param")
+ << QString::fromUtf8("ListElement { foo: QT_TRID_NOOP() }")
+ << QVariant(QString())
+ << QString("ListElement: improperly specified QT_TRID_NOOP");
}
void tst_qdeclarativelistmodel::static_i18n()