diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-08-24 00:20:16 (GMT) |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-08-24 00:20:16 (GMT) |
commit | 89a99fb94e12c6d582537048f3c977fb4d4058a7 (patch) | |
tree | a6aa4c6fed2e663aeec43d13190fa9027aaf628e | |
parent | a28f9a0204fcf7ab4ecf7546fc455f5db3aa7387 (diff) | |
download | Qt-89a99fb94e12c6d582537048f3c977fb4d4058a7.zip Qt-89a99fb94e12c6d582537048f3c977fb4d4058a7.tar.gz Qt-89a99fb94e12c6d582537048f3c977fb4d4058a7.tar.bz2 |
Remove the overhead of string conversion from the vector() built-in
Reviewed-by: Aaron Kennedy
-rw-r--r-- | src/declarative/qml/qmlengine.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 7f2a3e1..351bd8a 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -71,6 +71,7 @@ #include <QtCore/qthread.h> #include <QtCore/qcoreapplication.h> #include <QtCore/qdir.h> +#include <QtGui/qvector3d.h> #include <qmlcomponent.h> #include "private/qmlcomponentjs_p.h" #include "private/qmlmetaproperty_p.h" @@ -727,10 +728,7 @@ QScriptValue QmlEnginePrivate::vector(QScriptContext *ctxt, QScriptEngine *engin qsreal x = ctxt->argument(0).toNumber(); qsreal y = ctxt->argument(1).toNumber(); qsreal z = ctxt->argument(2).toNumber(); - QString s = QString::number(x) + QLatin1Char(',') + - QString::number(y) + QLatin1Char(',') + - QString::number(z); - return QScriptValue(s); + return engine->newVariant(qVariantFromValue(QVector3D(x, y, z))); } QmlScriptClass::QmlScriptClass(QmlEngine *bindengine) |