aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativescriptstring.cpp
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2011-06-08 13:18:35 +1000
committerMichael Brasser <michael.brasser@nokia.com>2011-06-09 10:10:09 +1000
commitccf706d0bb2d9f70f5a8c18e4aab8ee7e6369817 (patch)
tree7019d21c843ad3c4e02fdff38d81615b56f56ee0 /src/declarative/qml/qdeclarativescriptstring.cpp
parentb8154d2b6b1a6c0145a099554c9166b4d35630fe (diff)
Optimized QDeclarativeScriptString constructor for QDeclarativeExpression.
When the compiler sees a script string, it will attempt to rewrite it and store the id for the rewrite in the script string. We can then create a QDeclarativeExpression using the id, which saves us a rewrite at runtime. Reviewed-by: Aaron Kennedy
Diffstat (limited to 'src/declarative/qml/qdeclarativescriptstring.cpp')
-rw-r--r--src/declarative/qml/qdeclarativescriptstring.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/declarative/qml/qdeclarativescriptstring.cpp b/src/declarative/qml/qdeclarativescriptstring.cpp
index f544393b9b..02d6e5603e 100644
--- a/src/declarative/qml/qdeclarativescriptstring.cpp
+++ b/src/declarative/qml/qdeclarativescriptstring.cpp
@@ -40,19 +40,10 @@
****************************************************************************/
#include "qdeclarativescriptstring.h"
+#include "qdeclarativescriptstring_p.h"
QT_BEGIN_NAMESPACE
-class QDeclarativeScriptStringPrivate : public QSharedData
-{
-public:
- QDeclarativeScriptStringPrivate() : context(0), scope(0) {}
-
- QDeclarativeContext *context;
- QObject *scope;
- QString script;
-};
-
/*!
\class QDeclarativeScriptString
\since 4.7
@@ -75,8 +66,8 @@ and the class could choose how to handle it. Typically, the class will evaluate
the script at some later time using a QDeclarativeExpression.
\code
-QDeclarativeExpression expr(scriptString.context(), scriptString.script(), scriptStr.scopeObject());
-expr.value();
+QDeclarativeExpression expr(scriptString);
+expr.evaluate();
\endcode
\sa QDeclarativeExpression