09-25-2012 10:52 AM
Hi
Sorry, more Qt issues...
Is there a way to get access to geolocation and compass data within a Qt application? Looking at the NDK docs, it seems that an application has to register for specific events to get this data. There doesn't seem to be any API calls of the form "get_latitude()" or "get_heading()", except those that parse an event.
I suppose a more general question is -- Do native platform events come into a Qt application's event loop at all? And, if so, in what form?
Best wishes
Kevin
09-25-2012 11:56 AM
09-25-2012 12:08 PM
Thanks for the reply, but I'm a bit confused...
The example you refer to in the Recipes section does bps_get_event() in a loop. If I do that in a separate thread, won't the call to bps_get_event() also consume events that ought to go to the user interface? Or does the Qt implementation get events in a completely different way (ie., not calling bps_get_event())?
Sorry if I'm missing something here.
09-25-2012 12:55 PM
09-26-2012 03:37 AM
For the compass, use QCompass from QtMobility, which is now part of the NDK.
Location API is also part of the NDK, though I don't know the details.
About native BPS events: Qt's event loop integrates BPS events, there is no need to create a seperate thread for that.
In Qt4, use QAbstractEventDispatcher::setEventFilter() to receive native BPS events. Note that native event filters are chained, setEventFilter() returns the previous one - make sure to pass all events through to the previous event fitler, otherwise Qt itself will miss out important events.
09-26-2012 05:11 AM
OK, thanks. I will look into that approach.