summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlexpression.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-10-29 05:56:57 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-10-29 05:56:57 (GMT)
commit5b3fc8dfb20934e5a64c111335a292337320195a (patch)
tree1f3a51415daab55693fd0bca93099a39f1a24e1a /src/declarative/qml/qmlexpression.cpp
parentb624cb89591298b3c786f6ba6dd9fb5c454caf20 (diff)
downloadQt-5b3fc8dfb20934e5a64c111335a292337320195a.zip
Qt-5b3fc8dfb20934e5a64c111335a292337320195a.tar.gz
Qt-5b3fc8dfb20934e5a64c111335a292337320195a.tar.bz2
Store filename as a QUrl rather than convert to QString.
Saves about 700KB heap in samegame.
Diffstat (limited to 'src/declarative/qml/qmlexpression.cpp')
-rw-r--r--src/declarative/qml/qmlexpression.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp
index e5e5cf9..7c69c16 100644
--- a/src/declarative/qml/qmlexpression.cpp
+++ b/src/declarative/qml/qmlexpression.cpp
@@ -92,7 +92,7 @@ void QmlExpressionPrivate::init(QmlContext *ctxt, const QString &expr,
void QmlExpressionPrivate::init(QmlContext *ctxt, void *expr, QmlRefCount *rc,
QObject *me, const QUrl &url, int lineNumber)
{
- data->fileName = url.toString();
+ data->url = url;
data->line = lineNumber;
quint32 *exprData = (quint32 *)expr;
@@ -113,7 +113,7 @@ void QmlExpressionPrivate::init(QmlContext *ctxt, void *expr, QmlRefCount *rc,
#if !defined(Q_OS_SYMBIAN) //XXX Why doesn't this work?
if (!dd->programs.at(progIdx)) {
dd->programs[progIdx] =
- new QScriptProgram(data->expression, data->fileName, data->line);
+ new QScriptProgram(data->expression, data->url.toString(), data->line);
}
#endif
@@ -310,12 +310,12 @@ QVariant QmlExpressionPrivate::evalQtScript(QObject *secondaryScope, bool *isUnd
if (data->expressionRewritten) {
data->expressionFunction = scriptEngine->evaluate(data->expression,
- data->fileName, data->line);
+ data->url.toString(), data->line);
} else {
QmlRewrite::RewriteBinding rewriteBinding;
const QString code = rewriteBinding(data->expression);
- data->expressionFunction = scriptEngine->evaluate(code, data->fileName, data->line);
+ data->expressionFunction = scriptEngine->evaluate(code, data->url.toString(), data->line);
}
scriptEngine->popContext();
@@ -484,7 +484,7 @@ void QmlExpression::setTrackChange(bool trackChange)
QUrl QmlExpression::sourceFile() const
{
Q_D(const QmlExpression);
- return QUrl(d->data->fileName);
+ return d->data->url;
}
/*!
@@ -498,13 +498,13 @@ int QmlExpression::lineNumber() const
}
/*!
- Set the location of this expression to \a line of \a fileName. This information
+ Set the location of this expression to \a line of \a url. This information
is used by the script engine.
*/
-void QmlExpression::setSourceLocation(const QUrl &fileName, int line)
+void QmlExpression::setSourceLocation(const QUrl &url, int line)
{
Q_D(QmlExpression);
- d->data->fileName = fileName.toString();
+ d->data->url = url;
d->data->line = line;
}