@@ -341,6 +341,16 @@ static void loadDummyDataFiles(QQmlEngine &engine, const QString& directory)
341341 }
342342}
343343
344+static QObject *s_testRootObject = nullptr;
345+static QObject *testRootObject(QQmlEngine *engine, QJSEngine *jsEngine)
346+{
347+ Q_UNUSED(jsEngine);
348+ if (!s_testRootObject) {
349+ s_testRootObject = new QObject(engine);
350+ }
351+ return s_testRootObject;
352+}
353+
344354static void usage()
345355{
346356 qWarning("Usage: uqmlscene [options] <filename>");
@@ -470,6 +480,9 @@ int main(int argc, char ** argv)
470480 loadDummyDataFiles(engine, fi.path());
471481 }
472482 QObject::connect(&engine, SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit()));
483+
484+ qmlRegisterSingletonType<QObject>("Qt.test.qtestroot", 1, 0, "QTestRootObject", testRootObject);
485+
473486 component->loadUrl(options.file);
474487 if ( !component->isReady() ) {
475488 qWarning("%s", qPrintable(component->errorString()));