[maemo-developers] Stopping QML update when not visible

From: Cornelius Hald hald at icandy.de
Date: Mon May 30 17:23:52 EEST 2011
Hi Andrew,

I can't answer all of this, but I'll give it a try anyways :)

On Mon, 2011-05-30 at 14:55 +0100, Andrew Flegg wrote:
> Qt Quick 1.1 apparently features a "Qt.application.active" read-only
> property[1] which can be connected (somehow) to stopping animations,
> reading sensors and so on.

Yes, should be possible with 1.1 - but I've not tried it yet. Even if
you have this property it might still be a lot of work to disable most
of your functionality depending on how your app is coded and what it
does. I made a suggestion on how to improve this here[1].

If you're talking about Attitude (same features as old version?) it
should probably be enough to disconnect from the accelerometer.

> However, in my rewrite of Attitude[2] in QML, I'd like to do something
> similar. In fact, given my app's running at 50-60% CPU, I'd consider
> it a blocker to replacing the Pymaemo & Cairo implementation already
> in Extras. So, I'd even accept some hacky C++ way.

The 50%-60% CPU is the new QML implementation? Sounds a bit much, maybe
you need to enable OpenGL for drawing?

> Thoughts welcome. To be honest, it's amazing (and disappointing) that
> there isn't a way of doing this in Qt Quick 1.0. Can anyone confirm
> whether or not it's at least not updating the screen when hidden (it
> does in the task manager), and it's only the accelerometer signalling
> I need to switch off?

It might not update the screen, but everything else is definitively on.

Exposing a property (like isActive) from C++ is straight forward. The
question however is how to use Qt/C++ to detect whether or not the app
is in the foreground, screen lock is on, etc...

Unfortunately I'm not aware of a cross platform (MeeGo, Maemo, Symbian)
solution, so you have to code it up for each individual platform.

Hmm, somehow it doesn't really feel like this post was actually
helpful ;)

Cheers,
Conny


[1] http://bugreports.qt.nokia.com/browse/QTBUG-18245


More information about the maemo-developers mailing list