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>
This commit is contained in:
Juha Vuolle 2021-09-09 12:22:55 +03:00
parent 3d890fa955
commit 956e7bbe21
2 changed files with 6 additions and 6 deletions

View File

@ -49,7 +49,7 @@
**
****************************************************************************/
import QtQuick 2.0
import QtQuick
Rectangle {
id: back

View File

@ -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();
}