Hi David,

I did as you said, but it doesn't really work as expected.

Subclassing QGraphicsGeoMap, adding map objects and exposing it all to
QML does work fine. The trouble starts with the mouse events. My code
looks like this:

void MapWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
{
    qDebug() << "Mouse Released";

    QList<QGeoMapObject*> objects =
            mapObjectsAtScreenPosition(event->screenPos());

    for (int i = 0; i < objects.length(); ++i) {
        qDebug() << "Found object: " << objects[i];
    }
}

There are a couple of problems:
 * Using QGeoMapCircleObject, the area where an object is found is much
smaller than the graphical representation of that circle. Also it looks
like it's affected by zooming.

 * Using QGeoMapPixmapObject, I can click as much as I want and never is
an object found.

 * Using a QGeoMapGroupObject containing a QGeoMapCircleObject and a
QGeoMapPixmapObject, sometimes the pixmap is found, sometimes the
circle, sometimes both. Never is the group object found. I would expect
the group object to be found, not the individual child objects.

I'm can put that into JIRA if you want, but maybe I'm just doing
something stupid.

Thanks!
Conny


On Wed, 2010-11-10 at 00:41 +0100, david.la...@nokia.com wrote:
> Hi Conny,
> 
> At present the best way to do this would be to subclass QGraphicsGeoMap and 
> override the event handlers for the mouse.  The MapViewer example does this 
> if you want a starting point.
> 
> Once you have the position of the mouse click you can use 
> QGraphicsGeoMap::objectsAtScreenPosition to work out if your POI was clicked.
> 
> Some circumstances have changed a little since we decided to do behaviour 
> modification through overriding event handlers - we're currently wondering if 
> there's a sensible way to have platform-map-default-behaviour out of the box 
> (while still being customizable for those who need it).  If we can do that in 
> a BC manner we'll put it on our list.
> 
> As well as this, we'll most likely have both map wide and per object mouse 
> handling in the final Maps QML - as long as I can cobble together the 
> requisite magic :)
> 
> Cheers,
> 
> Dave
> 
> > -----Original Message-----
> > From: qt-mobility-feedback-boun...@trolltech.com [mailto:qt-mobility-
> > feedback-boun...@trolltech.com] On Behalf Of ext Cornelius Hald
> > Sent: Wednesday, 10 November 2010 2:21 AM
> > To: qt-mobility-feedback@trolltech.com
> > Subject: [Qt-mobility-feedback] Clickable map object (Qt Mobility 1.1)
> > 
> > Hi,
> > 
> > I know it's currently not possible to properly work with map objects
> > through QML, but is there a way to create clickable map objects using C
> > ++?
> > 
> > I want to draw some POIs on the map and if the user clicks them I need
> > to get a signal. I'm willing to implement this part using C++, but I
> > can't find a way to do it.
> > 
> > Please let me know if it's possible and if not, whether or not it's
> > planned for 1.1 final.
> > 
> > Thanks a lot!
> > Conny
> > 
> > 
> > 
> > _______________________________________________
> > Qt-mobility-feedback mailing list
> > Qt-mobility-feedback@trolltech.com
> > http://lists.trolltech.com/mailman/listinfo/qt-mobility-feedback


_______________________________________________
Qt-mobility-feedback mailing list
Qt-mobility-feedback@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-mobility-feedback

Reply via email to