问题
I've tried to build a webkit app using HTML5 geoposition APIs to get the current coordinates. I've also turned on the geolocation feature but it fails to start with error
Failed to start Geolocation service
Then I've tried to use QGetPositionInfoSource
, but it can't find any available source to use. I wonder, is Positioning API supported on desktop applications?
回答1:
That's a big no-no.
Directly from the documentation:
The Qt Positioning API provides positioning information via QML and C++ interfaces. Currently the API is supported on Android, BlackBerry 10, iOS and Linux (using GeoClue).
The same applies for Qt 5.4 as can be seen in the corresponding snapshot documentation page here.
UPDATE
Support for the whole BlackBerry platform has been dropped. On the other hand, support for Positioning API on desktop platforms will be available with the next release of the framework, Qt 5.6. The current documentation snapshot is pretty clear about that:
The Qt Positioning API provides positioning information via QML and C++ interfaces.
Currently the API is supported on Android, iOS, OS X, Linux (using GeoClue version 0.12.99), Windows (with GPS receivers exposed as a serial port providing NMEA sentences), and WinRT (using Windows.Devices.Geolocation).
Thus, download a development snapshot and try out this new desktop feature.
来源:https://stackoverflow.com/questions/27355674/positioning-api-support-on-desktop-platforms