How to dynamically add map objects to QML MAP element? Or how to create customised Map widget?
-
Yes you're right. Actually I've reported that bug. Unfortunately I don't know a way to get the mouse events on a devices with QtM < 1.2. I'm also waiting that QtM 1.2 will finally be available for devices.
On Maemo5 I've tested it with QtM 1.2 and it's actually working. On Symbian and for Ovi, we still have to wait :(
-
Conny,
Thaks again for your help. I resolved the issue.
I'm checking mapObjects boundingBox and check if contains clicked coordinate.
Regards
-
Sounds like a good work-around. Very nice!
Thanks for sharing!
Conny -
Nice! I have also decided to give qml a try and of course are running into the same issues. I have started to make a minimal demo app from conny's example and would like to setup a wiki page or similar as i think we should document this a little bit, so others can re-use this.
-
harabaum,
Please post link here, when u are done with demo :)
Regards
-
Ok, "here":http://wiki.meego.com/QML/QGraphicsGeoMap is the wiki page. Please contribute your findings and let's try to make this into a small complete guide for this. I e.g. found that the map doesn't scale when the window size changes.
-
Thanks Till,
what problems do you have with scaling? If I anchor the map to the QML root item and then scale the window the map size is increased. What's the result you get? -
The map just doesn't scale with the window. These are my very first minutes with qml, so i may just be missing something. What do you e.g. mean by anchoring? Would you mind changing the appropriate parts in the wiki page?
-
Ah ok, just try this:
@
Rectangle {
id: page
anchors.fill: parentMap {
anchors.fill: parent
}
}
@Ok, now you won't see the rectangle anymore, but you get the point.
-
Also you might need the following in main.cpp:
@
view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
@That will always scale the root QML item to the size of the QDeclarativeView.
-
Thanks, Conny. With these two changes, the map scales nicely!
And feel free to do changes/extensions to the wiki yourself :-)