Results 1 to 2 of 2

Thread: Qt embedded, multitouch and tslib with multitouch support

  1. #1
    Join Date
    May 2008
    Location
    Spain
    Posts
    92
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Qt embedded, multitouch and tslib with multitouch support

    Hello,

    I am interesting in qt embedded with gestures.
    At this moment, I use qt 4.8.4 with tslib using a multitouch screen configurate as single touch an it works fine.

    Now I replace my old tslib library with a new one that it has a multitouch support.
    Using ts_test with debug, library detect all points with your ID and position.

    But now, I dont known how use this in Qt.
    All touch examples only use one finger. If I use two fingers, only one touch is active.

    Has anybody any experience using multitouch with Qt embedded??

    Bestregards

  2. #2
    Join Date
    May 2008
    Location
    Spain
    Posts
    92
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qt embedded, multitouch and tslib with multitouch support

    Hello again,

    After read several pages, My conclusion is that TSLIB is not the correct plugin to handle multi touch points.

    Qt Code:
    1. bool QWSTslibMouseHandlerPrivate::get_sample(struct ts_sample *sample)
    2. {
    3. if (!calibrated)
    4. return (ts_read_raw(dev, sample, 1) == 1);
    5.  
    6. return (ts_read(dev, sample, 1) == 1);
    7. }
    8.  
    9. int StackCnt;
    10. void QWSTslibMouseHandlerPrivate::readMouseData()
    11. {
    12. if (!qt_screen)
    13. return;
    14.  
    15. for(;;) {
    16. struct ts_sample sample = lastSample;
    17. bool pressed = wasPressed;
    18.  
    19. // Fast return if there's no events.
    20. if (!get_sample(&sample))
    21. return;
    22.  
    23. pressed = (sample.pressure > 0);
    24.  
    25. // Only return last sample unless there's a press/release event.
    26. while (pressed == wasPressed) {
    27. if (!get_sample(&sample))
    28. break;
    29. pressed = (sample.pressure > 0);
    30. }
    31.  
    32. // work around missing coordinates on mouse release in raw mode
    33. if (!calibrated && !pressed && sample.x == 0 && sample.y == 0) {
    34. sample.x = lastSample.x;
    35. sample.y = lastSample.y;
    36. }
    37.  
    38. int dx = sample.x - lastSample.x;
    39. int dy = sample.y - lastSample.y;
    40.  
    41. // Remove small movements in oppsite direction
    42. if (dx * lastdx < 0 && qAbs(dx) < jitter_limit) {
    43. sample.x = lastSample.x;
    44. dx = 0;
    45. }
    46. if (dy * lastdy < 0 && qAbs(dy) < jitter_limit) {
    47. sample.y = lastSample.y;
    48. dy = 0;
    49. }
    50.  
    51. if (wasPressed == pressed && dx == 0 && dy == 0)
    52. return;
    53.  
    54. #ifdef TSLIBMOUSEHANDLER_DEBUG
    55. qDebug() << "last" << QPoint(lastSample.x, lastSample.y)
    56. << "curr" << QPoint(sample.x, sample.y)
    57. << "dx,dy" << QPoint(dx, dy)
    58. << "ddx,ddy" << QPoint(dx*lastdx, dy*lastdy)
    59. << "pressed" << wasPressed << pressed;
    60. #endif
    61.  
    62. lastSample = sample;
    63. wasPressed = pressed;
    64. if (dx != 0)
    65. lastdx = dx;
    66. if (dy != 0)
    67. lastdy = dy;
    68.  
    69. const QPoint p(sample.x, sample.y);
    70. if (calibrated) {
    71. // tslib should do all the translation and filtering, so we send a
    72. // "raw" mouse event
    73. handler->QWSMouseHandler::mouseChanged(p, pressed);
    74. } else {
    75. handler->sendFiltered(p, pressed);
    76. }
    77. }
    78. }
    To copy to clipboard, switch view to plain text mode 

    I could read only one sample and it can not handle slots and trancking_id, then, in my opinion, it is impossible to handle a multitouch events with this code.
    If I want to touch two buttons, I think I need to handle MT_SLOT and MT_TRACKING_ID to determinate how many fingers are pressed touch screen.

    Finally, i am going to create my own mouse handler plugin but I only have a bit problem.
    I dont known how to send a touchevevnt from plugin. somebody knowns?

    Qt Code:
    1. qt_translateRawTouchEvent(QWidget *window, QTouchEvent::DeviceType deviceType, const QList<QTouchEvent::TouchPoint> &touchPoints);
    To copy to clipboard, switch view to plain text mode 

    I have found this function but it need pointer to widget, but in my new mouse plugin I dont known the pointer to widget.

    Is it possible to setup widget as NULL and qt_translateRawTouchEvent send touch events to upper layer???
    I have tried with some examples but it doesnt receive any touch events.

    Best regards.

Similar Threads

  1. Qt MultiTouch on Embedded Linux
    By wyjyan in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 18th June 2012, 11:13
  2. Multitouch driver for Qt Embedded
    By sonulohani in forum Qt Programming
    Replies: 0
    Last Post: 14th June 2012, 13:58
  3. Qt Multitouch implementation
    By sonulohani in forum Qt Programming
    Replies: 0
    Last Post: 7th June 2012, 06:51
  4. Multitouch and N900
    By acano in forum Qt Programming
    Replies: 1
    Last Post: 30th September 2010, 08:04
  5. Support for tslib in Qt3 Embedded
    By Vortex in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 19th February 2010, 10:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.