PDA

View Full Version : Tablet Events in QGraphicsItem



Soapbubble
14th May 2011, 14:57
Hi,

I have recently switched to the Graphics View framework in my painting application. Everything works fine, except for the fact that I can't find a way to capture events from my (wacom) tablet. Of course QWidget had tabletEvent, but what does QGraphicsItem offer for that purpose?
The only mention of the word "tablet" i could find in the class documentation is in QGraphicsItem::ItemClipsToShape flag's description:

The item cannot draw or receive mouse, tablet, drag and drop or hover events outside its shape.
but nothing more.
I'm sure there is a way around this so I don't have to return to QWidget + QGraphicsProxyWidget

Thanks

Soapbubble
15th May 2011, 09:01
Actually I have tried to go for embedding the painting widget into a QGraphicsProxyWidget, but tablet events are still not recognized. I suppose QGraphicsProxyWidget doesn't forwards them to the QWidget object, despite the documentation that claims

Through QGraphicsProxyWidget, Graphics View is able to deeply integrate the client widget features including its cursors, tooltips, mouse, tablet and keyboard events
Now I really am confused.
Any help please
Thank you!

Added after 1 29 minutes:

OK, so after further research, it seems that, if I stick with the graphics view framework, I have to manually capture all the events that the QGraphicsView viewport recieves and somehow determine which one is generated by the tablet. Afterwards, I should translate this event into a custom subclass of QGraphicsSceneEvent while leaving any other scene event intact. Finally, the QGraphicsProxyWidget or QGraphicsItem item in my scene should be able to receive my custom event and process it.

Again, this approach is new to me so I'm not sure it would work.
So, as a summary to my 3 posts, what answer do I deserve? :)