on xenial help sign in
Registers a dummy QObject as QTestRootObject in uqmlscene in order to fix make trySomething with Qt 5.2.
commit2bf8e425a4f5a7c1d0d1db75355bfa5474b14604 authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 1 Apr 2014, 22:56 (13 years ago) parent8e2a4cb375c905
1 file changed+13
tests/uqmlscene/main.cpp+13
tests/uqmlscene/main.cpp+13
@@ -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()));