Use pointers to objects for consistency
This commit is contained in:
parent
21a4b9e0e8
commit
b429c474c6
1 changed files with 14 additions and 8 deletions
|
@ -45,18 +45,24 @@ int main(int argc, char *argv[])
|
||||||
QGuiApplication* app = SailfishApp::application(argc, argv);
|
QGuiApplication* app = SailfishApp::application(argc, argv);
|
||||||
QQuickView* view = SailfishApp::createView();
|
QQuickView* view = SailfishApp::createView();
|
||||||
|
|
||||||
Battery battery;
|
Battery* battery = new Battery();
|
||||||
Settings settings;
|
Settings* settings = new Settings();
|
||||||
|
QTimer* updater = new QTimer();
|
||||||
|
|
||||||
QTimer updater;
|
QObject::connect(updater, SIGNAL(timeout()), battery, SLOT(updateData()));
|
||||||
QObject::connect(&updater, SIGNAL(timeout()), &battery, SLOT(updateData()));
|
updater->start(3000);
|
||||||
updater.start(3000);
|
|
||||||
|
|
||||||
view->rootContext()->setContextProperty("battery", &battery);
|
view->rootContext()->setContextProperty("battery", battery);
|
||||||
view->rootContext()->setContextProperty("settings", &settings);
|
view->rootContext()->setContextProperty("settings", settings);
|
||||||
|
|
||||||
view->setSource(SailfishApp::pathTo("qml/harbour-batterybuddy.qml"));
|
view->setSource(SailfishApp::pathTo("qml/harbour-batterybuddy.qml"));
|
||||||
view->showFullScreen();
|
view->showFullScreen();
|
||||||
|
|
||||||
return app->exec();
|
int retval = app->exec();
|
||||||
|
|
||||||
|
delete updater;
|
||||||
|
delete battery;
|
||||||
|
delete settings;
|
||||||
|
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue