@phil999
I too have struggled with getting the Tslib touchscreen implementation to work. I've spent a lot of time sprinkling print statements around in the Qt code figuring out what is going on. What I've learned is this:
Tslib and Evdev are separate implementations that are NOT equivalent. The Tslib implementation was developed for single touch (generally resistive) touchscreens while the Evdev implementation was developed for multi-touch (generally capacitive) touchscreens. For single touch screens, every action possible can be characterized as an equivalent mouse operation and that is what Tslib does. (Note that the Tslib plugin calls handleMouseEvent, not handleTouchEvent). Conversely the Evdev implementation does handle multi-touch which has no mouse equivalent so Evdev characterizes the touchscreen events as touch events.
You MUST get your touchscreen properly calibrated so that the coordinates are within the screen dimensions. Mouse events will only be reported to an object if they are within the object. Try recalibrating the touchscreen (ts_calibrate) and then run ts_test to be sure the touchscreen operation is correct. (We found that some versions of ts_calibrate don't work correctly and made some changes in the code ourselves.)
Event type 50 is a notifier event that I believe is triggering the QTsLibMouseHandler::readMouseData(). You can ignore these.
Your event filter should be looking for Mouse events. Probably these will be GraphicsSceneMousePress, GraphicsSceneMouseRelease, GraphicsSceneMouseMove, GrabMouse and UngrabMouse. (But this is object dependent.) I was using the qtbase/examples/touch/knobs application for test and debug and in the Knob::sceneEvent() function in knob.cpp, I changed the case statement to look for those 5 events. On a touch-drag-release I typically see the following sequence:
GrabMouse
GraphicsSceneMousePress
A variable number of GraphicsSceneMouseMove
GraphicsSceneMouseRelease
UngrabMouse
Be sure to intercept these events and not call the default QGraphicsItem::sceneEvent() handler. It will inhibit seeing all of the above events except the initial GrabMouse and GraphicsSceneMousePress
Hope this helps!