Pause Qt Symbian application when suspended in background
-
I am developing Qt application on symbian^3 device.
I have timer loop where I render graphics to the screen.
I have captured EEventFocusGained and EEventFocusLost events and I stop timer-loop when application has lost focus and start timer when focus is gained. I have done things like in this article:"http://www.developer.nokia.com/Community/Wiki/TSQ001585_-Detecting_focus_lost&gained_events_in_Qt_for_Symbian":http://www.developer.nokia.com/Community/Wiki/TSQ001585-Detecting_focus_lost&_gained_events_in_Qt_for_Symbian
My application stops updating the screen when focus is lost.
I have made part of user inteface with QML.
I am trying to publish this application in ovi store but QA still fails saying that timer-loop does not stop when application is suspended in background.
Is there some other events that I should capture or some other things' that I should take care?
-
Not very cross platform at all. I use this:
@
ApplicationActive::ApplicationActive(QObject *parent) :
QObject(parent)
{
appActive = true;
}bool ApplicationActive::isActive() {
return appActive;
}bool ApplicationActive::eventFilter(QObject *object, QEvent *event)
{
//qDebug() << event->type();
if (event->type() == QEvent::ApplicationActivate || event->type() == QEvent::WindowActivate) {
qDebug() << "Active";
appActive = true;
}if(event->type() == QEvent::ApplicationDeactivate || event->type() == QEvent::WindowDeactivate) { qDebug() << "Hidden"; appActive = false; } emit isActiveWindowChanged(); return false;
}
@then in main.cpp
@
ApplicationActive aa;
viewer.installEventFilter(&aa);
viewer.rootContext()->setContextProperty("application",&aa);
@Then from your QML you can check if you should trigger your timer event with application.isActive()