View Full Version : Drop events

11th May 2011, 15:39

I'm developing a painting application that needs support for Wacom tablet input and mouse input. The mouse part is working very well, but the Wacom tablet has a lot of drag.

I have used qDebug to see the event info, and the problem is that Wacom sends a lot of events, and the mouse sends very few. It is like the mouse events are generated when the application requests them (idle?) while the wacom tablet events are sent like every x milliseconds and placed in a list...

This is what the mouse list looks like:

Mouse.Press : 200, 476
Mouse.Move : 200, 476
Mouse.Move : 210, 476
Mouse.Move : 220, 476
Mouse.Release : 220, 476

And this is what the tablet list looks like:

Tablet.Press : 200, 476
Tablet.Move : 200, 476
Tablet.Move : 200, 476
Tablet.Move : 200, 476
Tablet.Move : 200, 476
Tablet.Move : 201, 476
Tablet.Move : 201, 476
Tablet.Move : 201, 476
Tablet.Move : 202, 476
Tablet.Move : 202, 476
Tablet.Move : 202, 476
Tablet.Move : 202, 476
Tablet.Release : 202, 476

So, my question is... is there a way to clear this list or eliminate all QXXXEvent events from the event loop.

Thank you!

11th May 2011, 16:28
This is related to the tablet driver. It is responsible for producing those events and in normal circumstances they are usefull to detect the "pressure" of the pen on the tablet (at least that's my guess). Since the mouse doesn't have such concept, it only generates events when you move the pointer. You might try tweaking the options of your tablet driver but there is nothing you can do with it inside your application, you can just ignore those events yourself.

12th May 2011, 19:05
Thanks wysota,
The thing is that I don't know which events to ignore, and which ones to process.
Is it possible to check all the list of events waiting to be processed, and flag those events that should be ignored. I could do this when my tool finishes processing the QTabletEvent... then I can check the list of events and flag (?) all those QTabletEvents in the list.
Thanks again!

13th May 2011, 00:58
You have to base the decision of which events to ignore on what your application is doing and the purpose of handling the events in the first place. Nobody is going to decide it for you.

13th May 2011, 18:41
Thank you wysota,

I found two methods for ignoring the unwanted TabletMove events. I'm posting it here for if somebody else needs something similar:

1. The easy one:
A mod operator ignores 15 of every 16 TabletMove events. Fast to implement but it's not balanced... some processing (like orbiting a 3D viewport) is dependant on content and this method can still have a lot of drag, or feel not continuous.

2. A QAcceptTabletEvent event.
After my event is processed by tabletEvent I set a m_ignore_tablet_event flag to true, and then post a new QAcceptTabletEvent to my widget. Next tabletEvent is called, if my m_ignore_tablet_event is false and the event is tabletMove, I ignore it, otherwise, I process it.
On event() I set m_ignore_tablet_events to false.
So this two brackets ignore all events that were posted by the tablet while the previous QTabletEvent was being processed by my widget.

line: 53
line: 214
line: 231

Note: I only ignore QEvent::tabletMove events... QEvent::tabletRelease and QEvent::TabletPress should always be processed!