How to use a map (like google maps) with Qt Quick?
-
I want to display a map with my Qt Quick 2.1 application, but I cant find a good example on how to do that. I dont develop for a nokia device, but for android.
So can somebody post a working example of using a map? It could be google maps, open streetmap or whatever :)
Or give me a hint, where I can find more info on that topic that is not relatetd to a nokia device?Edit: WebView doesnt work on mobile devices, so that is no option.
-
One of my bookmark : "examples":http://developer.nokia.com/Community/Wiki/QtQuick_Maps_Examples
Its QtQuick 1 but, it would not be difficult for you to bring it on QQ2.
-
Ignore Previous, try this ""example"":http://qt-project.org/doc/qt-4.8/declarative-modelviews-webview-googlemaps.html
EDIT : Broken link
-
Thanks for your reply. The first example (which I should ignore ;)) is an example I tried and couldnt get to work.
The second example I wasnt able to get to work with QtQuick 2. But unfortunately it uses a webview, which doesnt work on mobile devices, because of the lack of a mobile library. So it wouldnt help :(During the last hours I built my own webview gmaps example and saw the problem with mobile devices and webviews :(
So I need something that works without the webview. -
Oh Yes, it is "not available":http://lists.qt-project.org/pipermail/android-development/2013-May/000114.html yet, afaik.
Now, i am curious how to show the gmaps with out webkit!
-
It doesnt have to be gmaps, just any maptool would be fine, if it works on the mobile plattforms like android.
-
There is the QTLocation Module (http://qt.gitorious.org/qt/qtlocation/) which should also provide a Map Element, but it seems that it isn't currently bundled and there is no stable release of it yet. But you can try to use it.
-
Thanks, I will give it a try, but I think I am going to have a hard time to add this external lib to the android deployment process.
-
If you get it to work, please report back how you did it :)
-
The location module should work, I think. But you'll need to either write your own data source / plugin, or find one somewhere on the web, as the mobility ones won't work with it, and I can't remember whether or not the ones included in the Qt5 QtLocation module can be used without a license.
Anyway, a webview should still work:
@
import QtQuick 2.0
import QtWebKit 3.0WebView {
url: "http://maps.google.com"
}
@Cheers,
Chris. -
The Qt Location module is planned to be released as part of Qt 5.2, so the deployment process should become easier once Qt 5.2 is released. It includes both the nokia and Open Street Map plugins. The OSM plugin is usable out-of-the-box. To use the nokia plugin you will need to obtain application tokens by registering at "developer.here.com":http://developer.here.com/
-
So waiting for QT 5.2 and becoming familiar with the qt location module seems to be the way to go :)
@Chris
WebView doesnt work on mobile devices yet.