December 19, 2011

liangbowen liangbowen
Lab Rat
6 posts

QT 4.7 cannot receive multi-touch events.

 

I’ve wrote a multi-touch device driver, which created /dev/input/event4 multi-touch event. and it’s been tested by mtdev, but when I use QT touch example “fingerpaint” to test multi-touch, it seems QT cannot recognize multi-touch events produced by /dev/input/event4.

(None of TouchBegin/TouchUpdate/TouchEnd ever triggered)

  1. bool ScribbleArea::event(QEvent *event)
  2. {
  3.      printf("TouchUpdate:%d\n",event->type());
  4.     switch (event->type()) {
  5.     case QEvent::TouchBegin:
  6.     case QEvent::TouchUpdate:
  7.     {
  8.         printf("TouchUpdate\n");
  9.  
  10.     }
  11.     case QEvent::TouchEnd:
  12.     {
  13. .....

So I wander if QT is hard coded to use other input event device instead of /dev/input/event4 ?
Is there any way to fix this problem? thanks!

[EDIT: code formatting, please wrap in @-tags, Volker]

10 replies

December 19, 2011

agocs agocs
Lab Rat
13 posts

Assuming this is about desktop X11 builds: Unlike Qt 5, Qt 4 has no proper evdev touch input support.

You don’t see anything in fingerpaint because there is nothing that would feed touch events into QApplication. There is some evdev code in qapplication_x11.cpp but that’s not compiled in by default and is specific to certain hardware. So with 4.7 your best chance is to enable and fix the code in question.

Alternatively you can write your own evdev handling code and feed touch events to Qt via the internal (but exported) function qt_translateRawTouchEvent().

December 19, 2011

liangbowen liangbowen
Lab Rat
6 posts

yes, it’s x86 desktop X11 builds and Thanks!

so using Qt5 will also be a solution? Is there a stable Qt5 release available for download?

December 19, 2011

sierdzio sierdzio
Area 51 Engineer
2346 posts

No, it’s not even in alpha yet. It’s planned to be released in summer 2012. You can grab current code on Gitorious – it usually works.

 Signature 

(Z(:^

December 19, 2011

liangbowen liangbowen
Lab Rat
6 posts

Roger, Thank you very much!

December 19, 2011

sierdzio sierdzio
Area 51 Engineer
2346 posts

Oh, and to save you some time: here’s a manual on how to set it up: LINK [developer.qt.nokia.com].

 Signature 

(Z(:^

December 19, 2011

agocs agocs
Lab Rat
13 posts

Well, at least in Qt 5 we have a “generic” plug-in in qtbase/src/plugins/generic/touchscreen (be sure to check README about how to set it up) which serves touch events straight from evdev. It should be usable with any of the Linux-based platforms (xcb, eglfs, etc.). Note that the plug-in in question is still work in progress.

December 20, 2011

liangbowen liangbowen
Lab Rat
6 posts

OK, Thank you all again.

December 20, 2011

liangbowen liangbowen
Lab Rat
6 posts

Oh, sorry to bother you guys again. If my multi-touch evdev can’t work for Qt, how can other multi-touch device works? If Qt can’t support multi-touch device then what’s Qt TouchBegin/TouchUpdate/TouchEnd event used for? I mean, we all uses standard Linux multi-touch “ABS_MT_” events, if Qt do support multi-touch devices, why Qt support other multi-touch devices and can’t support mine? what are the differences?

If I have to use Qt5 or implement custom Qt codes to use my multi-touch evdev, shouldn’t it be the same case with all other multi-touch devices?

December 20, 2011

liangbowen liangbowen
Lab Rat
6 posts

after some digging, i found Bradley T. Hughes’s original post about how QT multi-touch support is created. I’ve got a better understanding now. So here is how I understand Qt multi-touch support on Linux, please correct me if I’m wrong.

In Window 7, QT uses multi-touch API directly to implements multi-touch event.
But in Linux , Qt rely on X11 input events, though Linux kernel/driver now supports multi-touch devices, X11 does not support multi-touch events, that’s why we’ve to do our own Qt x11 implementation.

Am I correct?

February 22, 2012

ecloud ecloud
Lab Rat
2 posts

http://cgit.freedesktop.org/xorg/driver/xf86-input-evdev/log/

xinput-evdev driver only just merged the multitouch features:

2011-12-22 Merge branch ‘multitouch’

 
  ‹‹ send raw data to QAudioOutput.      Problem in getting tooltip? ››

You must log in to post a reply. Not a member yet? Register here!