aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmljavascriptexpression_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-04-13 10:29:45 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-04-24 19:57:32 +0000
commit895fe4b881ae819981c337d65c8fae5f5daaf164 (patch)
treeb10c1b2bd3e062bfbca122547774c15abde93f6b /src/qml/qml/qqmljavascriptexpression_p.h
parent590c23b23c5f60d78aa92030f89259833496b8be (diff)
Get rid of QQmlAbstractExpression
The class is always used together with QQmlJavaScriptExpression, so we can just as well fold the functionality together into one class and simplify our code. Change-Id: I23820e51efaaea16ae5db7e2153a827d7b22999e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/qml/qqmljavascriptexpression_p.h')
-rw-r--r--src/qml/qml/qqmljavascriptexpression_p.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/qml/qml/qqmljavascriptexpression_p.h b/src/qml/qml/qqmljavascriptexpression_p.h
index 989d5a0b0d..c8f54527a0 100644
--- a/src/qml/qml/qqmljavascriptexpression_p.h
+++ b/src/qml/qml/qqmljavascriptexpression_p.h
@@ -89,7 +89,7 @@ private:
QQmlDelayedError **prevError;
};
-class QQmlJavaScriptExpression
+class Q_QML_PRIVATE_EXPORT QQmlJavaScriptExpression
{
public:
// Although this looks crazy, we implement our own "vtable" here, rather than relying on
@@ -103,6 +103,7 @@ public:
};
QQmlJavaScriptExpression(VTable *vtable);
+ virtual ~QQmlJavaScriptExpression();
QV4::ReturnedValue evaluate(QQmlContextData *, const QV4::Value &function, bool *isUndefined);
QV4::ReturnedValue evaluate(QQmlContextData *, const QV4::Value &function, QV4::CallData *callData, bool *isUndefined);
@@ -115,6 +116,13 @@ public:
inline QObject *scopeObject() const;
inline void setScopeObject(QObject *v);
+ bool isValid() const { return context() != 0; }
+
+ QQmlContextData *context() const { return m_context; }
+ void setContext(QQmlContextData *context);
+
+ virtual void refresh();
+
class DeleteWatcher {
public:
inline DeleteWatcher(QQmlJavaScriptExpression *);
@@ -143,10 +151,9 @@ public:
const QString &code,
const QString &filename, quint16 line,
QV4::PersistentValue *qmlscope = 0);
-protected:
- ~QQmlJavaScriptExpression();
private:
+ friend class QQmlContextData;
typedef QQmlJavaScriptExpressionGuard Guard;
friend void QQmlJavaScriptExpressionGuard_callback(QQmlNotifierEndpoint *, void **);
@@ -176,6 +183,11 @@ private:
// activeGuards:flag2 - useSharedContext
QBiPointer<QObject, DeleteWatcher> m_scopeObject;
QForwardFieldList<Guard, &Guard::next> activeGuards;
+
+ QQmlContextData *m_context;
+ QQmlJavaScriptExpression **m_prevExpression;
+ QQmlJavaScriptExpression *m_nextExpression;
+
};
QQmlJavaScriptExpression::DeleteWatcher::DeleteWatcher(QQmlJavaScriptExpression *e)