summaryrefslogtreecommitdiff
path: root/examples/quick/controls/text/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quick/controls/text/src/main.cpp')
-rw-r--r--examples/quick/controls/text/src/main.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/examples/quick/controls/text/src/main.cpp b/examples/quick/controls/text/src/main.cpp
index 0fc064dc..8d2b8dd0 100644
--- a/examples/quick/controls/text/src/main.cpp
+++ b/examples/quick/controls/text/src/main.cpp
@@ -49,24 +49,14 @@
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
- QQmlEngine engine;
-
qmlRegisterType<DocumentHandler>("org.qtproject.example", 1, 0, "DocumentHandler");
-
- QQmlComponent component(&engine);
- component.loadUrl(QUrl("qrc:/qml/main.qml"));
- if ( !component.isReady() ) {
- qWarning("%s", qPrintable(component.errorString()));
- return -1;
- }
- QObject *topLevel = component.create();
+ QQmlApplicationEngine engine(QUrl("qrc:/qml/main.qml"));
+ QObject *topLevel = engine.rootObjects().value(0);
QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
if ( !window ) {
qWarning("Error: Your root item has to be a Window.");
return -1;
}
-
- QObject::connect(&engine, SIGNAL(quit()), &app, SLOT(quit()));
window->show();
return app.exec();
}