diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-08-31 21:37:13 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-08-31 21:37:13 (GMT) |
commit | da038b5f74f98d73e25c10e12817cf46ad48f7f9 (patch) | |
tree | e2c8f6b3c56bc3e2503df66c036307bf18b3ffae | |
parent | f4131ce2d2a0be63c61c4b0222c7ada723cf449e (diff) | |
download | Qt-da038b5f74f98d73e25c10e12817cf46ad48f7f9.zip Qt-da038b5f74f98d73e25c10e12817cf46ad48f7f9.tar.gz Qt-da038b5f74f98d73e25c10e12817cf46ad48f7f9.tar.bz2 |
Use QApplication in QDeclarativeEngine example.
Using QCoreApplication causes a crash if you tried to load
graphical components.
Task-number: QTBUG-13319
-rw-r--r-- | doc/src/declarative/qmlruntime.qdoc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/doc/src/declarative/qmlruntime.qdoc b/doc/src/declarative/qmlruntime.qdoc index d44e774..9a84237 100644 --- a/doc/src/declarative/qmlruntime.qdoc +++ b/doc/src/declarative/qmlruntime.qdoc @@ -104,20 +104,22 @@ can be constructed directly instead. In this case, \c application.qml is loaded as a QDeclarativeComponent instance rather than placed into a view: \code - #include <QCoreApplication> + #include <QApplication> #include <QDeclarativeEngine> + #include <QDeclarativeContext> + #include <QDeclarativeComponent> int main(int argc, char *argv[]) { - QCoreApplication app(argc, argv); + QApplication app(argc, argv); QDeclarativeEngine engine; - QDeclarativeContext *windowContext = new QDeclarativeContext(engine.rootContext()); + QDeclarativeContext *objectContext = new QDeclarativeContext(engine.rootContext()); QDeclarativeComponent component(&engine, "application.qml"); - QObject *window = component.create(windowContext); + QObject *object = component.create(objectContext); - // ... delete window and windowContext when necessary + // ... delete object and objectContext when necessary return app.exec(); } |