diff options
Diffstat (limited to 'src/qml/qml/qqmlerror.cpp')
-rw-r--r-- | src/qml/qml/qqmlerror.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlerror.cpp b/src/qml/qml/qqmlerror.cpp index 88129b7240..0c8e46bd8d 100644 --- a/src/qml/qml/qqmlerror.cpp +++ b/src/qml/qml/qqmlerror.cpp @@ -71,7 +71,7 @@ QT_BEGIN_NAMESPACE ^ \endcode - Note that the QtQuick 1 version is named QDeclarativeError + Note that the \l {Qt Quick 1} version is named QDeclarativeError \sa QQuickView::errors(), QQmlComponent::errors() */ @@ -84,10 +84,11 @@ public: QString description; quint16 line; quint16 column; + QObject *object; }; QQmlErrorPrivate::QQmlErrorPrivate() -: line(0), column(0) +: line(0), column(0), object() { } @@ -122,6 +123,7 @@ QQmlError &QQmlError::operator=(const QQmlError &other) d->description = other.d->description; d->line = other.d->line; d->column = other.d->column; + d->object = other.d->object; } return *this; } @@ -215,6 +217,27 @@ void QQmlError::setColumn(int column) } /*! + Returns the nearest object where this error occurred. + Exceptions in bound property expressions set this to the object + to which the property belongs. It will be 0 for all + other exceptions. + */ +QObject *QQmlError::object() const +{ + if (d) return d->object; + else return 0; +} + +/*! + Sets the nearest \a object where this error occurred. + */ +void QQmlError::setObject(QObject *object) +{ + if (!d) d = new QQmlErrorPrivate; + d->object = object; +} + +/*! Returns the error as a human readable string. */ QString QQmlError::toString() const |