summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@insta.fi>2021-09-09 12:22:55 +0300
committerJuha Vuolle <juha.vuolle@insta.fi>2021-09-09 16:54:13 +0300
commit956e7bbe2109f507807b16a02702427fcaaf3377 (patch)
treebbee64fa90e1ec5e34d023b4211ea65dfb479bf5
parent3d890fa95579ff57812b350bf14a73d21316ae23 (diff)
Remove error messages on lowenergyscanner example app exit
The QML View was created on heap and outlived the 'device' context property on stack. This resulted in distracting 'null' property access errors on exit. In addition remove unnecessary QML import versioning. Pick-to: 6.2 Change-Id: I5cb7d219582ef8e9a72a3f7e514e78fb16a54e2f Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
-rw-r--r--examples/bluetooth/lowenergyscanner/assets/main.qml2
-rw-r--r--examples/bluetooth/lowenergyscanner/main.cpp10
2 files changed, 6 insertions, 6 deletions
diff --git a/examples/bluetooth/lowenergyscanner/assets/main.qml b/examples/bluetooth/lowenergyscanner/assets/main.qml
index 2424dbcf..ea3214e2 100644
--- a/examples/bluetooth/lowenergyscanner/assets/main.qml
+++ b/examples/bluetooth/lowenergyscanner/assets/main.qml
@@ -49,7 +49,7 @@
**
****************************************************************************/
-import QtQuick 2.0
+import QtQuick
Rectangle {
id: back
diff --git a/examples/bluetooth/lowenergyscanner/main.cpp b/examples/bluetooth/lowenergyscanner/main.cpp
index 6ae75580..8bb332a6 100644
--- a/examples/bluetooth/lowenergyscanner/main.cpp
+++ b/examples/bluetooth/lowenergyscanner/main.cpp
@@ -62,11 +62,11 @@ int main(int argc, char *argv[])
QGuiApplication app(argc, argv);
Device d;
- auto view = new QQuickView;
- view->rootContext()->setContextProperty("device", &d);
+ QQuickView view;
+ view.rootContext()->setContextProperty("device", &d);
- view->setSource(QUrl("qrc:/assets/main.qml"));
- view->setResizeMode(QQuickView::SizeRootObjectToView);
- view->show();
+ view.setSource(QUrl("qrc:/assets/main.qml"));
+ view.setResizeMode(QQuickView::SizeRootObjectToView);
+ view.show();
return QGuiApplication::exec();
}