Use pointers to objects for consistency

This commit is contained in:
Matti Viljanen 2020-03-20 16:18:14 +02:00
parent 21a4b9e0e8
commit b429c474c6
No known key found for this signature in database
GPG key ID: CF32A1495158F888

View file

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