diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-07-02 06:15:41 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-07-02 06:15:41 (GMT) |
commit | 0549df8e6b43fc6aa3d3750bcd0346344f272fd1 (patch) | |
tree | 94e532f2e3018aaf7b01b896e255b2376aa626b3 /src/declarative/qml | |
parent | 49bceaf197a5964f244ac094aaa75b35cf3ada49 (diff) | |
parent | c84fefd59090c0d0f757572fe14b493d94759808 (diff) | |
download | Qt-0549df8e6b43fc6aa3d3750bcd0346344f272fd1.zip Qt-0549df8e6b43fc6aa3d3750bcd0346344f272fd1.tar.gz Qt-0549df8e6b43fc6aa3d3750bcd0346344f272fd1.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/qmlbasicscript.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlbindablevalue.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlcompiler.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlcomponent.cpp | 25 | ||||
-rw-r--r-- | src/declarative/qml/qmlcomponent.h | 1 | ||||
-rw-r--r-- | src/declarative/qml/qmlengine.cpp | 9 | ||||
-rw-r--r-- | src/declarative/qml/qmlmetaproperty.cpp | 4 | ||||
-rw-r--r-- | src/declarative/qml/qmlparser.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlscriptparser.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlvme.cpp | 3 |
10 files changed, 39 insertions, 13 deletions
diff --git a/src/declarative/qml/qmlbasicscript.cpp b/src/declarative/qml/qmlbasicscript.cpp index 8b0cb42..0cfb587 100644 --- a/src/declarative/qml/qmlbasicscript.cpp +++ b/src/declarative/qml/qmlbasicscript.cpp @@ -45,7 +45,7 @@ #include <private/qmlengine_p.h> #include <private/qmlcontext_p.h> #include <QStack> -#include <qfxperf.h> +#include <private/qfxperf_p.h> #include <private/qmlrefcount_p.h> #include <private/qmljsast_p.h> #include <private/qmljsengine_p.h> diff --git a/src/declarative/qml/qmlbindablevalue.cpp b/src/declarative/qml/qmlbindablevalue.cpp index f447d4f..8e74250 100644 --- a/src/declarative/qml/qmlbindablevalue.cpp +++ b/src/declarative/qml/qmlbindablevalue.cpp @@ -45,7 +45,7 @@ #include <qmlcontext.h> #include <qmlinfo.h> #include <QVariant> -#include <qfxperf.h> +#include <private/qfxperf_p.h> #include <QtCore/qdebug.h> Q_DECLARE_METATYPE(QList<QObject *>); diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 57d77ac..aa2cf84 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "private/qmlcompiler_p.h" -#include <qfxperf.h> +#include <private/qfxperf_p.h> #include "qmlparser_p.h" #include "private/qmlscriptparser_p.h" #include <qmlpropertyvaluesource.h> diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp index 1144639..d6b38c9 100644 --- a/src/declarative/qml/qmlcomponent.cpp +++ b/src/declarative/qml/qmlcomponent.cpp @@ -46,7 +46,7 @@ #include "qmlvme_p.h" #include "qml.h" #include <QStack> -#include <qfxperf.h> +#include <private/qfxperf_p.h> #include <QStringList> #include <qmlengine.h> #include <QFileInfo> @@ -372,6 +372,29 @@ QList<QmlError> QmlComponent::errors() const } /*! + Return the list of errors that occured during the last compile or create + operation, as a single string. An empty string is returned if isError() + is not set. + + This function is similar to errors(), except more useful when called from + QML. C++ code should usually use errors(). + + \sa errors() +*/ +QString QmlComponent::errorsString() const +{ + Q_D(const QmlComponent); + QString ret; + if(!isError()) + return ret; + foreach(const QmlError &e, d->errors){ + ret += e.url().toString() + ":" + QString::number(e.line()) + " " + + e.description() + "\n"; + } + return ret; +} + +/*! Return the component URL. This is the URL passed to either the constructor, or the loadUrl() or setData() methods. */ diff --git a/src/declarative/qml/qmlcomponent.h b/src/declarative/qml/qmlcomponent.h index db34e16..b29c123 100644 --- a/src/declarative/qml/qmlcomponent.h +++ b/src/declarative/qml/qmlcomponent.h @@ -82,6 +82,7 @@ public: Q_INVOKABLE bool isLoading() const; QList<QmlError> errors() const; + Q_INVOKABLE QString errorsString() const; QUrl url() const; diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 2d98063..ad3f4b6 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -57,7 +57,7 @@ #include <QDebug> #include <QMetaObject> #include "qml.h" -#include <qfxperf.h> +#include <private/qfxperf_p.h> #include <QStack> #include "private/qmlbasicscript_p.h" #include "private/qmlcompiledcomponent_p.h" @@ -835,6 +835,7 @@ QScriptValue QmlEngine::qmlScriptObject(QObject* object, QmlEngine* engine) sprite = component.createObject(); if(sprite == 0){ // Error Handling + print(component.errorsString()); }else{ sprite.parent = page; sprite.x = 200; @@ -842,8 +843,8 @@ QScriptValue QmlEngine::qmlScriptObject(QObject* object, QmlEngine* engine) } \endcode - If you want to just create an arbitrary string of QML, instead of an - existing qml component or qml file, consider the evalQML() function. + If you want to just create an arbitrary string of QML, instead of + loading a qml file, consider the evalQML() function. \sa QmlComponent::createObject(), QmlEngine::createQMLObject() */ QScriptValue QmlEngine::createComponent(QScriptContext *ctxt, QScriptEngine *engine) @@ -854,6 +855,8 @@ QScriptValue QmlEngine::createComponent(QScriptContext *ctxt, QScriptEngine *eng if(ctxt->argumentCount() != 1 || !activeEngine){ c = new QmlComponent(activeEngine); }else{ + //### This url needs to be resolved in the context that the function + //### is called - it can't be done here. QUrl url = QUrl(ctxt->argument(0).toString()); c = new QmlComponent(activeEngine, url, activeEngine); } diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index 307f76f..90acd72 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -42,7 +42,7 @@ #include "qmlmetaproperty.h" #include "qmlmetaproperty_p.h" #include <qml.h> -#include <qfxperf.h> +#include <private/qfxperf_p.h> #include <QStringList> #include <qmlbindablevalue.h> #include <qmlcontext.h> @@ -1002,7 +1002,7 @@ QMetaMethod QmlMetaProperty::method() const */ QmlMetaProperty QmlMetaProperty::createProperty(QObject *obj, const QString &name) { - QStringList path = name.split('.'); + QStringList path = name.split(QLatin1Char('.')); QObject *object = obj; diff --git a/src/declarative/qml/qmlparser.cpp b/src/declarative/qml/qmlparser.cpp index df5e26e..2e7eb69 100644 --- a/src/declarative/qml/qmlparser.cpp +++ b/src/declarative/qml/qmlparser.cpp @@ -48,7 +48,7 @@ #include <QRectF> #include <private/qmlvme_p.h> #include <qmlbindablevalue.h> -#include <qfxperf.h> +#include <private/qfxperf_p.h> #include <qml.h> #include "private/qmlcomponent_p.h" #include <qmlcomponent.h> diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index cb65c5c..1c88018 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -55,7 +55,7 @@ #include <QCoreApplication> #include <QtDebug> -#include <qfxperf.h> +#include <private/qfxperf_p.h> QT_BEGIN_NAMESPACE diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp index 0f49e1e..0d88e02 100644 --- a/src/declarative/qml/qmlvme.cpp +++ b/src/declarative/qml/qmlvme.cpp @@ -40,14 +40,13 @@ ****************************************************************************/ #include "qmlvme_p.h" -#include <qfxperf.h> +#include <private/qfxperf_p.h> #include <private/qmlboundsignal_p.h> #include <private/qmlstringconverters_p.h> #include "private/qmetaobjectbuilder_p.h" #include "private/qmldeclarativedata_p.h" #include <qml.h> #include <private/qmlcustomparser_p.h> -#include <qperformancelog.h> #include <QStack> #include <QWidget> #include <private/qmlcompiledcomponent_p.h> |