summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2011-01-04 04:21:26 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2011-01-04 05:16:25 (GMT)
commit31460847fed4bc0867c3fd78466fed32e407fafb (patch)
treea4ab745fde58621b86e97e5daaddcc26f5df1559
parent086f33dd4c70be03adcbc1703997afa27add920b (diff)
downloadQt-31460847fed4bc0867c3fd78466fed32e407fafb.zip
Qt-31460847fed4bc0867c3fd78466fed32e407fafb.tar.gz
Qt-31460847fed4bc0867c3fd78466fed32e407fafb.tar.bz2
Fix translation in Connections element.
Provide the component's file name to the expression as the translation context. Task-number: QTBUG-10300 Reviewed-by: Martin Jones
-rw-r--r--src/declarative/util/qdeclarativeconnections.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/declarative/util/qdeclarativeconnections.cpp b/src/declarative/util/qdeclarativeconnections.cpp
index 15e5ac5..e102f2c 100644
--- a/src/declarative/util/qdeclarativeconnections.cpp
+++ b/src/declarative/util/qdeclarativeconnections.cpp
@@ -45,6 +45,7 @@
#include <qdeclarativeproperty_p.h>
#include <qdeclarativeboundsignal_p.h>
#include <qdeclarativecontext.h>
+#include <qdeclarativecontext_p.h>
#include <qdeclarativeinfo.h>
#include <QtCore/qdebug.h>
@@ -257,7 +258,11 @@ void QDeclarativeConnections::connectSignals()
if (prop.isValid() && (prop.type() & QDeclarativeProperty::SignalProperty)) {
QDeclarativeBoundSignal *signal =
new QDeclarativeBoundSignal(target(), prop.method(), this);
- signal->setExpression(new QDeclarativeExpression(qmlContext(this), 0, script));
+ QDeclarativeExpression *expression = new QDeclarativeExpression(qmlContext(this), 0, script);
+ QDeclarativeData *ddata = QDeclarativeData::get(this);
+ if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty())
+ expression->setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber);
+ signal->setExpression(expression);
d->boundsignals += signal;
} else {
if (!d->ignoreUnknownSignals)