aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types/qqmllistmodel.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-04-26 14:42:39 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-28 12:50:17 +0200
commit68a662a2e15b790080ea12c2434f6e1fe60bda1b (patch)
tree2ac79cccf047e4ed5f61f06f9a3823715975daa1 /src/qml/types/qqmllistmodel.cpp
parentda4f5504822189a7efd279d2380e0737f9de3968 (diff)
Fix translations in states causing failing assertions
This is a smaller fix suitable for the release branch, merely adding support for translations to the bytearray compilation step for states and ensuring a consistent error message when qsTr is used in list models. The proper fix will be done in dev that eliminates the entire intermediate QByteArray storage for custom compilers. Task-number: QTBUG-38492 Change-Id: If5171f16eb742c718e48b8bbcb265b0c241cd5e7 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/types/qqmllistmodel.cpp')
-rw-r--r--src/qml/types/qqmllistmodel.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index 8eab51a99f..0056276d52 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -2325,6 +2325,10 @@ bool QQmlListModelParser::compileProperty(const QV4::CompiledData::QmlUnit *qmlU
} else if (binding->type == QV4::CompiledData::Binding::Type_Boolean) {
d += char(Boolean);
d += char(binding->valueAsBoolean());
+ } else if (binding->type == QV4::CompiledData::Binding::Type_Translation
+ || binding->type == QV4::CompiledData::Binding::Type_TranslationById) {
+ error(binding, QQmlListModel::tr("ListElement: cannot use script for property value"));
+ return false;
} else if (binding->type == QV4::CompiledData::Binding::Type_Script) {
QString scriptStr = binding->valueAsScriptString(&qmlUnit->header);
if (definesEmptyList(scriptStr)) {