How to dynamically add map objects to QML MAP element? Or how to create customised Map widget?
-
wrote on 1 Apr 2011, 12:17 last edited by
You're welcome! I'm glad I could help :)
-
wrote on 4 Jul 2011, 19:21 last edited by
Hi Conny and Juan,
Would you just post som QML example how do you use tat MapWidget in QML. Im new in QML/Qt wold.
Many Thanks
-
wrote on 5 Jul 2011, 07:29 last edited by
Hi Jano,
if you're new with QML you should start by using the default map item. It has also much improved in QtM 1.2. Have a look here:
http://doc.qt.nokia.com/qtmobility-1.2/declarative-location-mapviewer-mapviewer-qml.html -
wrote on 5 Jul 2011, 09:09 last edited by
Hi i tried your example.
Map is succesfully created and pois are shown.. But im not receiving any mousevents.. :(
-
wrote on 5 Jul 2011, 09:47 last edited by
Actually, im getting mouse events only on device but no in Simulator. Did u have same issue?
Many Thanks!
-
wrote on 5 Jul 2011, 20:27 last edited by
I've not used the simulator for quite some time and currently still have only an old version installed, so I don't know. All I know is that you need at least QtM 1.2. If you have this and it's still not working I'd say it's a bug and you should report it.
-
wrote on 6 Jul 2011, 06:03 last edited by
Hi Conny,
I resolve issue. I'm gettin mouse events in simulator aswell.
Do you maybe know if is possible to add mapObject to the map so that onclick event can be handled?
Somehow extend QGeoMapObject?Unfortunatelly method mapObjectsAtScreenPosition(lastPos) does not work on devices. I'm retreiving empty objects lists.
I have latest Qt SDK 1.1.2 and usign Qt Mobility 1.1
Many Thanks for your help
-
wrote on 6 Jul 2011, 06:42 last edited by
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 :(
-
wrote on 6 Jul 2011, 06:44 last edited by
Conny,
Thaks again for your help. I resolved the issue.
I'm checking mapObjects boundingBox and check if contains clicked coordinate.
Regards
-
wrote on 6 Jul 2011, 06:55 last edited by
Sounds like a good work-around. Very nice!
Thanks for sharing!
Conny -
wrote on 6 Jul 2011, 14:01 last edited by
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.
-
wrote on 6 Jul 2011, 15:19 last edited by
harabaum,
Please post link here, when u are done with demo :)
Regards
-
wrote on 6 Jul 2011, 18:18 last edited by
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.
-
wrote on 6 Jul 2011, 18:56 last edited by
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? -
wrote on 6 Jul 2011, 18:59 last edited by
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?
-
wrote on 6 Jul 2011, 19:04 last edited by
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.
-
wrote on 6 Jul 2011, 19:06 last edited by
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.
-
wrote on 7 Jul 2011, 07:05 last edited by
Thanks, Conny. With these two changes, the map scales nicely!
And feel free to do changes/extensions to the wiki yourself :-)