diff options
author | Lars Knoll <lars.knoll@qt.io> | 2016-12-05 13:17:52 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2016-12-09 14:02:00 +0000 |
commit | 3d582fd5c17b011a606001fe8635e732e4609328 (patch) | |
tree | 893ac86c9f764dd64f0119ad429ae5245bd4f90e /src/qml | |
parent | 82ee8341fba141e2e1e44948d2161a694add1584 (diff) |
Add a setSourceLocation() method
Change-Id: I611ab4fe5dd59cb8e07b0fa69ce22c7df5a6c3f2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/qml/qqmljavascriptexpression.cpp | 9 | ||||
-rw-r--r-- | src/qml/qml/qqmljavascriptexpression_p.h | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index 96a9f5b6b1..a9e309396e 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -142,6 +142,13 @@ QQmlSourceLocation QQmlJavaScriptExpression::sourceLocation() const return QQmlSourceLocation(); } +void QQmlJavaScriptExpression::setSourceLocation(const QQmlSourceLocation &location) +{ + if (m_sourceLocation) + delete m_sourceLocation; + m_sourceLocation = new QQmlSourceLocation(location); +} + void QQmlJavaScriptExpression::setContext(QQmlContextData *context) { if (m_prevExpression) { @@ -457,7 +464,7 @@ void QQmlJavaScriptExpression::setFunctionObject(const QV4::FunctionObject *o) m_v4Function = o->d()->function; if (o->isBinding()) { const QV4::QQmlBindingFunction *b = static_cast<const QV4::QQmlBindingFunction *>(o); - m_sourceLocation = new QQmlSourceLocation(*b->d()->bindingLocation); + setSourceLocation(*b->d()->bindingLocation); m_v4Function = b->d()->originalFunction->function; } Q_ASSERT(m_v4Function); diff --git a/src/qml/qml/qqmljavascriptexpression_p.h b/src/qml/qml/qqmljavascriptexpression_p.h index 8a230efeeb..4d88c987b8 100644 --- a/src/qml/qml/qqmljavascriptexpression_p.h +++ b/src/qml/qml/qqmljavascriptexpression_p.h @@ -114,6 +114,7 @@ public: inline void setScopeObject(QObject *v); QQmlSourceLocation sourceLocation() const; + void setSourceLocation(const QQmlSourceLocation &location); bool isValid() const { return context() != 0; } |