[Qgis-developer] QgsMapCanvasItem and mouse events -- Python

Florian El Ahdab felahdab at gmail.com
Sun Nov 1 16:54:28 EST 2009


Hi Tim.

Thanks for your answer.

The renderComplete signal works perfectly with the code I sent, and my
items get refreshed correctly after the canvas is rendered. The SLOT
macro is not needed for the destination of the signal (but I don't
really know the details of PyQT...)

My problem is about the mouse events. According to the QGraphicsItem
API documentation, if I override the mousePressEvent and
mouseReleaseEvent methods, my objects should get the corresponding
events without further settings... but they don't.

Thanks for the help.
Florian

On 11/1/09, Mailing Lists <lists at linfiniti.com> wrote:
> Hi
>
> On Sun, Nov 1, 2009 at 12:00 PM, Florian El Ahdab <felahdab at gmail.com>
> wrote:
>> Hi.
>>
>> It seems my previous mail didn't make it to the list with the text...
>> weird.
>>
>> Let me try again.
>>
>> I am trying to subclass QgsMapCanvasItem so as do display items on top
>> of the maps.
>>
>> I would like those items to react to mouse events.
>>
>> I have implemented the handles for the mouse events as the Qt API
>> suggests, but my items do not seem to receive any events. The
>> isUnderMouse method returns coherent results when run from the python
>> console.
>>
>
> QtCore.QObject.connect(self.canvas,QtCore.SIGNAL( "renderComplete(
> QPainter * )" ),self.renderComplete)
>
>
> Dont you have to specify SLOT part of the signal macro?
>
> Regards
>
> Tim
>
>
>> The source file for my geographicitems is included.
>>
>> Thanks for your help.
>>
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>>
>
>
>
> --
> Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
> ==============================================
> Please do not email me off-list with technical
> support questions. Using the lists will gain
> more exposure for your issues and the knowledge
> surrounding your issue will be shared with all.
>
> Visit http://linfiniti.com to find out about:
>  * QGIS programming and support services
>  * Mapserver and PostGIS based hosting plans
>  * FOSS Consulting Services
> Skype: timlinux
> Irc: timlinux on #qgis at freenode.net
> ==============================================
>


More information about the Qgis-developer mailing list