From b429c474c6b1a5e9aa4158393b06aad67994faf8 Mon Sep 17 00:00:00 2001 From: Matti Viljanen Date: Fri, 20 Mar 2020 16:18:14 +0200 Subject: [PATCH] Use pointers to objects for consistency --- src/harbour-batterybuddy.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/harbour-batterybuddy.cpp b/src/harbour-batterybuddy.cpp index bb718d9..cf46e50 100644 --- a/src/harbour-batterybuddy.cpp +++ b/src/harbour-batterybuddy.cpp @@ -45,18 +45,24 @@ int main(int argc, char *argv[]) QGuiApplication* app = SailfishApp::application(argc, argv); QQuickView* view = SailfishApp::createView(); - Battery battery; - Settings settings; + Battery* battery = new Battery(); + Settings* settings = new Settings(); + QTimer* updater = new QTimer(); - QTimer updater; - QObject::connect(&updater, SIGNAL(timeout()), &battery, SLOT(updateData())); - updater.start(3000); + QObject::connect(updater, SIGNAL(timeout()), battery, SLOT(updateData())); + updater->start(3000); - view->rootContext()->setContextProperty("battery", &battery); - view->rootContext()->setContextProperty("settings", &settings); + view->rootContext()->setContextProperty("battery", battery); + view->rootContext()->setContextProperty("settings", settings); view->setSource(SailfishApp::pathTo("qml/harbour-batterybuddy.qml")); view->showFullScreen(); - return app->exec(); + int retval = app->exec(); + + delete updater; + delete battery; + delete settings; + + return retval; }