[Qt-interest] How to pass QTouchEvents from a single touch screen to Qt for "swipe" gesture

Bradley T. Hughes bradley.hughes at nokia.com
Tue Feb 9 10:37:53 CET 2010


On 02/08/2010 08:32 PM, pacybl wrote:
>
> I am very excited about the latest Qt 4.6 with gesture support.
>
> I have a single touch screen which provides BTN_TOUCH or BTN_LEFT
> through  linux event device to Qt. Recently I would like to implement the "swipe",
> signle touch, gesture with Qt 4.6 under Linux. I am not sure if there is a
> general way converting Linux Mouse events to QTouchEvent in order to get
> QGestureEvent under Linux with Qt 4.6 (qt embedded or X11)

For Qt/Embedded, I think it will be easier to do. The device driver 
(possibly the mouse driver, possibly another) could look for a device that 
supports the ABS_X and ABS_Y axes and BTN_TOUCH buttons (meaning we know 
it's a touch screen), and then adjust the QWS protocol to send the 
information as touch events, and the client will then need to generate and 
send QTouchEvents to its widgets. This does require hacking in the internals 
of Qt/Embedded to get it working, but I don't see it as an impossible task. 
With this done, adding support for multi-touch to Qt/Embedded will be easy, 
it's just a matter of adding support for the new Linux multi-touch input 
protocol (ABS_MT_POSITION_X, ABS_MT_POSITION_Y, ABS_MT_PRESSURE, and so on).

X11 is a different matter though. How do you detect a touch screen on X11? I 
haven't figured that out yet (and I don't want to unconditionally send 
single-finger touch events for every mouse event). There are ongoing 
discussions on the xorg-devel list on how to add support for multi-touch to 
X11 as well.

-- 
Bradley T. Hughes (Nokia-D-Qt/Oslo), bradley.hughes at nokia.com
Sandakervn. 116, P.O. Box 4332 Nydalen, 0402 Oslo, Norway



More information about the Qt-interest-old mailing list