[Qt-qml] No mouse events in C++ QML element

Harri Pasanen harri at mpaja.com
Fri Nov 18 18:42:34 CET 2011


Hi,

I'm trying to get mouse events in my QML plugin.

In my class inherited from QDeclarativeItem I implement the following 
virtual functions:

     void paint(QPainter *painter, const QStyleOptionGraphicsItem *, 
QWidget *widget = 0);
     void mousePressEvent(QGraphicsSceneMouseEvent *e);
     void mouseMoveEvent(QGraphicsSceneMouseEvent *e);
     void mouseReleaseEvent(QGraphicsSceneMouseEvent *e);

and the paint() is called and my widget is rendered ok.  But for some 
reason I receive no mouse events.

I'm inclined to think I'm missing something really simple, like toggling 
a flag somewhere.

Any hints what might be wrong?

Harri


More information about the Qt-qml mailing list