diff options
author | Samuel Gaist <samuel.gaist@edeltech.ch> | 2016-05-29 00:07:26 +0200 |
---|---|---|
committer | Sze Howe Koh <szehowe.koh@gmail.com> | 2016-06-19 09:06:41 +0000 |
commit | 0960561981b59cbd293aeb32e87dc8a7732fe521 (patch) | |
tree | 0798dfd7fc223d07058c51e20a076c456d0bb38f /src | |
parent | c8241e8551b9491081486cc98936ad5ad1824a1e (diff) |
Doc: Refactor cpp integration Message sample
Since MyItem.qml is a GUI element, the example as is triggers a
segfault when starting. This patch refactors the cpp code to make
it a GUI application.
Change-Id: I983c8c1945bd4be364c988ab9fdfa69e35e7b9de
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/doc/src/cppintegration/exposecppattributes.qdoc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/qml/doc/src/cppintegration/exposecppattributes.qdoc b/src/qml/doc/src/cppintegration/exposecppattributes.qdoc index f4f688520a..c7e4930bfb 100644 --- a/src/qml/doc/src/cppintegration/exposecppattributes.qdoc +++ b/src/qml/doc/src/cppintegration/exposecppattributes.qdoc @@ -119,13 +119,13 @@ from C++: \code int main(int argc, char *argv[]) { - QCoreApplication app(argc, argv); + QGuiApplication app(argc, argv); - QQmlEngine engine; + QQuickView view; Message msg; - engine.rootContext()->setContextProperty("msg", &msg); - QQmlComponent component(&engine, QUrl::fromLocalFile("MyItem.qml")); - component.create(); + view.engine()->rootContext()->setContextProperty("msg", &msg); + view.setSource(QUrl::fromLocalFile("MyItem.qml")); + view.show(); return app.exec(); } |