PDA

View Full Version : How to separate mouse and tablet event in QGraphicsView/Scene ?



chiaminhsu
29th April 2013, 18:21
Hi experts,

I want to draw by TabletEvent and drag objects by MouseEvent.

I have overwritten both tablet and mouse events in QGraphicsView.

The problem is, even I only use the tablet, mouse events are also invoked. (not always :confused:)

So I can not draw by TABLET and drag by MOUSE.

Is it possible to specify two events in the QGraphicsView ?

If you know that, can you give me some suggestion.

I confuse the problem in a long time :crying:

Thank your help

chiaminhsu
30th April 2013, 12:41
I review the document, Qt 4.7: QTabletEvent Class
http://harmattan-dev.nokia.com/docs/library/html/qt4/qtabletevent.html

....
The event handler QWidget::tabletEvent() receives all three types of tablet events. Qt will first send a tabletEvent then, if it is not accepted, it will send a mouse event. This allows applications that don't utilize tablets to use a tablet like a mouse, while also enabling those who want to use both tablets and mouses differently.


So I accept every event in tabletEvent(). The mouse events still happen while I use tablet.

What's wrong about it ?



void TabletCanvas::tabletEvent(QTabletEvent *event)
{
event->setAccepted(true);
..
}