[Qgis-user] QgsMapCanvasItem and mouse events

Florian El Ahdab felahdab at gmail.com
Fri Oct 30 16:03:01 PDT 2009


Hello the list.

I have been working with QGis and python and I am currently trying to
implement my own subclass of QgsMapCanvasItem in python to display mobile
positions over the map. The mobile and "over the map" part work already.

I would also like those items to be somehow "interactive", and I am
therefore trying to get the various mouse events that one can normally
expect from a QGraphicsItem. I implemented the folowing methods:
def mouseReleaseEvent(self, event):
def mousePressEvent(self, event):
def acceptedMouseEvents(self):

the boundingRect method has also been implemented and tested with a few
item.isUnderMouse() tries in the python console.

The mouse events do not seem to be dispatched to my items and I don't
understand why.

Maybe some of you already have the answer to this question.
The source code for my items is included.

Thank you for your help with this matter.

Florian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20091031/1b89d261/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: geographicitem.py
Type: application/octet-stream
Size: 2765 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20091031/1b89d261/attachment.obj>


More information about the Qgis-user mailing list