[SailfishDevel] How to get GPS Location in QML

christopher.lamb at thurweb.ch christopher.lamb at thurweb.ch
Tue Oct 29 14:28:11 UTC 2013

Hi Bolek

First of all you need to make sure that Positioning is correctly  
installed to the Emulator, to the SDK, and QtCreator is synched with  
the installation on the SDK.

I have done this via the RPM yaml file. I am not sure that mine is  
entirely correct (as you will see from other posts I am working on  
properly understanding the yaml file config, but for what it is worth,  
mine is pasted at the bottom of this post.

Note 1: for the yaml to take effect you need to "Deploy as RPM Package".
Note 2: in order for QT Creator to be aware of the new Positioning  
package and show PositionSource et al. in purple, you need to sync the  
SDK Control Center. Under Manage Target: SailfishOS-i486-x8 press the  
"sync" button. This should give you a new folder  
/$HOME/SailfishOSmersdk/targets/SailfishOS-i486-x86/usr/lib/qt5/qml/QtPositioning with a plugins.qmltypes and qmldir  

You can verify what the yaml / specify is installing via the "Compile  
Output" in Qt Creator, via the SDK Control Center in Qt Creator; and  
on the Emulator with "zypper se position" via ssh



//yaml file for app PositionSourceTest

Name: PositionSourceTest
Summary: My SailfishOS Application
Version: 0.1
Release: 1
Group: Qt/Qt
License: LICENSE
- '%{name}-%{version}.tar.bz2'
Description: |
   Short description of my SailfishOS Application
Configure: none
Builder: qtc5
- Qt5Core
- Qt5Qml
- Qt5Quick
- sailfishapp
- Qt5Positioning
- sailfishsilica-qt5
- qt5-qtdeclarative-import-location
- qt5-qtdeclarative-import-positioning
- /usr/share/icons/hicolor/90x90/apps
- /usr/share/applications
- /usr/share/PositionSourceTest
- /usr/bin
- '%{_datadir}/icons/hicolor/90x90/apps/%{name}.png'
- '%{_datadir}/applications/%{name}.desktop'
- '%{_datadir}/%{name}/qml'
- '%{_bindir}'
PkgBR: [qt5-qtdeclarative-import-positioning, qt5-qtpositioning-devel,  

Zitat von tw_bolek <tw_bolek at op.pl>:

> Hi Chris,
>>> So the import we need is Import QtPositioning 5.0
> Unfortunately, "QtPositioning 5.0" gives "QML module not found" and  
> it is underlined in red in QtCreator...  Adding QT += positioning   
> to the .pro file does not change anything.    There is no trace of  
> "QtPositioning" in sailfishos/mersdk/targets/.../usr/lib/qt5,   
> neither for arm nor for x86 (emulator).
> Bolek
> _______________________________________________
> SailfishOS.org Devel mailing list

More information about the Devel mailing list