summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
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
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')
-rw-r--r--src/declarative/qml/qmlbinding.cpp6
-rw-r--r--src/declarative/qml/qmlexpression.cpp16
-rw-r--r--src/declarative/qml/qmlexpression_p.h2
3 files changed, 12 insertions, 12 deletions
diff --git a/src/declarative/qml/qmlbinding.cpp b/src/declarative/qml/qmlbinding.cpp
index 317a4b3..83ca65b 100644
--- a/src/declarative/qml/qmlbinding.cpp
+++ b/src/declarative/qml/qmlbinding.cpp
@@ -170,15 +170,15 @@ void QmlBinding::update(QmlMetaProperty::WriteFlags flags)
if (!isUndefined && data->property.object() &&
!data->property.write(value, flags)) {
- QString fileName = data->fileName;
+ QUrl url = data->url;
int line = data->line;
- if (fileName.isEmpty()) fileName = QLatin1String("<Unknown File>");
+ if (url.isEmpty()) url = QUrl(QLatin1String("<Unknown File>"));
const char *valueType = 0;
if (value.userType() == QVariant::Invalid) valueType = "null";
else valueType = QMetaType::typeName(value.userType());
- data->error.setUrl(fileName);
+ data->error.setUrl(url);
data->error.setLine(line);
data->error.setColumn(-1);
data->error.setDescription(QLatin1String("Unable to assign ") +
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;
}
diff --git a/src/declarative/qml/qmlexpression_p.h b/src/declarative/qml/qmlexpression_p.h
index 4e13de3..6360852 100644
--- a/src/declarative/qml/qmlexpression_p.h
+++ b/src/declarative/qml/qmlexpression_p.h
@@ -98,7 +98,7 @@ public:
QObject *me;
bool trackChange;
- QString fileName;
+ QUrl url;
int line;
struct SignalGuard : public QGuard<QObject> {