aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp4
-rw-r--r--tests/auto/qml/qqmlinfo/data/Component.qml8
-rw-r--r--tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp14
3 files changed, 24 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 7051fb51da..5aaf79c9e5 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -1217,9 +1217,9 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo
}
ddata = QQmlData::get(instance, /*create*/true);
- ddata->lineNumber = obj->location.line;
- ddata->columnNumber = obj->location.column;
}
+ ddata->lineNumber = obj->location.line;
+ ddata->columnNumber = obj->location.column;
ddata->setImplicitDestructible();
if (static_cast<quint32>(index) == /*root object*/0 || ddata->rootObjectInCreation) {
diff --git a/tests/auto/qml/qqmlinfo/data/Component.qml b/tests/auto/qml/qqmlinfo/data/Component.qml
new file mode 100644
index 0000000000..fefbbfae76
--- /dev/null
+++ b/tests/auto/qml/qqmlinfo/data/Component.qml
@@ -0,0 +1,8 @@
+import QtQml 2.0
+
+QtObject {
+ property Component delegate: Component {
+ QtObject {
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp b/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp
index ada3f9e37b..5ff72de0a0 100644
--- a/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp
+++ b/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp
@@ -50,6 +50,7 @@ private slots:
void types();
void chaining();
void messageTypes();
+ void component();
private:
QQmlEngine engine;
@@ -216,6 +217,19 @@ void tst_qqmlinfo::messageTypes()
qmlWarning(nullptr) << QLatin1String("warning");
}
+void tst_qqmlinfo::component()
+{
+ QQmlComponent component(&engine, testFileUrl("Component.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != nullptr);
+ QQmlComponent *delegate = qobject_cast<QQmlComponent*>(object->property("delegate").value<QObject*>());
+ QVERIFY(delegate);
+
+ QString message = component.url().toString() + ":4:34: QML Component: Delegate error";
+ QTest::ignoreMessage(QtInfoMsg, qPrintable(message));
+ qmlInfo(delegate) << "Delegate error";
+}
+
QTEST_MAIN(tst_qqmlinfo)
#include "tst_qqmlinfo.moc"