diff options
Diffstat (limited to 'src/declarative/qml/qmlcomponent.cpp')
-rw-r--r-- | src/declarative/qml/qmlcomponent.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp index 0fd65d3..d6b38c9 100644 --- a/src/declarative/qml/qmlcomponent.cpp +++ b/src/declarative/qml/qmlcomponent.cpp @@ -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. */ |