[Interest] QGeoPositionInfo in QML

Paolo Angelelli paolo.angelelli at qt.io
Tue Oct 24 13:52:16 CEST 2017


Hi Julius,

so there is currently no easy way to have a single interoperable source for position info.
Either you use the C++ source, and QGeoPositionInfo or, QML's PositionSource and Position.

If you want to have the same source, and the data coming from that source in both C++ and QML, i currently see 2
approaches: either you register your own QGeoPositionInfo QML wrapper with accessors, and push objects
of this kind into QML from the C++ source, or you go the other way around, and extract the relevant bits
from a Position in a JS piece of code, and push those into some structure (even a variant map) to C++.

It might be worth considering to (privately?) export PositionSource, so that, if one has specific needs,
could depend on positioning-private, and use the class from Cpp..

On Tue, 26 Sep 2017 09:37:25 +0000
"Bullinger, Julius" <julius.bullinger at intel.com> wrote:

> Hi there,
> 
> in Qt Location, there's the QGeoPositionInfo class<http://doc.qt.io/qt-5/qgeopositioninfo.html> for storing geo positions.
> There's also the Position QML type<http://doc.qt.io/qt-5/qml-qtpositioning-position.html> with a matching interface to do the same in QML.
> 
> However, I haven't had success trying to expose a QGeoPosition object as Q_PROPERTY. In QML, the type will be reported as QVariant, and I cannot access any properties.
> 
> What is the supposed way to use QGeoPositionInfo in QML? There's QDeclarativePosition, but it's private.
> 
> Thanks and best regards,
> Julius
> 
> 
> Intel Deutschland GmbH
> Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
> Tel: +49 89 99 8853-0, www.intel.de
> Managing Directors: Christin Eisenschmid, Christian Lamprechter
> Chairperson of the Supervisory Board: Nicole Lau
> Registered Office: Munich
> Commercial Register: Amtsgericht Muenchen HRB 186928




More information about the Interest mailing list