on xenial help sign in
Registers a dummy QObject as QTestRootObject in uqmlscene in order to fix make trySomething with Qt 5.2.
2bf8e42Michael Zanetti
tests/uqmlscene/main.cpp+13
@@ -341,6 +341,16 @@ static void loadDummyDataFiles(QQmlEngine &engine, const QString& directory)
341 }
341 }
342}
342}
343
343
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+
344static void usage()
354static void usage()
345{
355{
346 qWarning("Usage: uqmlscene [options] <filename>");
356 qWarning("Usage: uqmlscene [options] <filename>");
@@ -470,6 +480,9 @@ int main(int argc, char ** argv)
470 loadDummyDataFiles(engine, fi.path());
480 loadDummyDataFiles(engine, fi.path());
471 }
481 }
472 QObject::connect(&engine, SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit()));
482 QObject::connect(&engine, SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit()));
483+
484+ qmlRegisterSingletonType<QObject>("Qt.test.qtestroot", 1, 0, "QTestRootObject", testRootObject);
485+
473 component->loadUrl(options.file);
486 component->loadUrl(options.file);
474 if ( !component->isReady() ) {
487 if ( !component->isReady() ) {
475 qWarning("%s", qPrintable(component->errorString()));
488 qWarning("%s", qPrintable(component->errorString()));