summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlinfo.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-09-02 03:34:07 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-09-02 03:34:07 (GMT)
commit9e7bd55bde0d614719c67977507b270dc7326f05 (patch)
treede830538b63bd59866ba69c7ce3ce1c7412c8c91 /src/declarative/qml/qmlinfo.cpp
parent74774eb9e7f5b232fdafd067f19b765ede87146f (diff)
downloadQt-9e7bd55bde0d614719c67977507b270dc7326f05.zip
Qt-9e7bd55bde0d614719c67977507b270dc7326f05.tar.gz
Qt-9e7bd55bde0d614719c67977507b270dc7326f05.tar.bz2
Save object creation line and column number
This info is used by the debugger interface, and by the qmlInfo() stream.
Diffstat (limited to 'src/declarative/qml/qmlinfo.cpp')
-rw-r--r--src/declarative/qml/qmlinfo.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/declarative/qml/qmlinfo.cpp b/src/declarative/qml/qmlinfo.cpp
index 65a4298..e47b4ab 100644
--- a/src/declarative/qml/qmlinfo.cpp
+++ b/src/declarative/qml/qmlinfo.cpp
@@ -40,6 +40,8 @@
****************************************************************************/
#include "qmlinfo.h"
+#include <private/qmldeclarativedata_p.h>
+#include <QtDeclarative/qmlcontext.h>
QT_BEGIN_NAMESPACE
@@ -80,7 +82,19 @@ QmlInfo::QmlInfo(QObject *object)
*this << "QML";
if (object)
*this << object->metaObject()->className();
- *this << "(unknown location):";
+ QmlDeclarativeData *ddata = QmlDeclarativeData::get(object);
+ if (ddata) {
+ QString location = QLatin1String("(");
+ location += ddata->outerContext->baseUrl().toString();
+ location += QLatin1String(":");
+ location += QString::number(ddata->lineNumber);
+ location += QLatin1String(":");
+ location += QString::number(ddata->columnNumber);
+ location += QLatin1String(")");
+ *this << location.toLatin1().constData();
+ } else {
+ *this << "(unknown location):";
+ }
}
/*!