QVTKInteractorAdapter asumes QTouchEvent point IDs start at zero when Qt specifies to not asume that

And because of this there is a bug where touch events are not working in linux machines with vtk.9 and qt 6.2

Qt seems to generate QTouch events with point IDs like 37 (for example) so when the event reaches the ProcessEvent function: it never does anything because of this code: (VTKI_MAX_POINTERS is defined as 5)

  if (t == QEvent::TouchBegin || t == QEvent::TouchUpdate || t == QEvent::TouchEnd)
  {
    QTouchEvent* e2 = dynamic_cast<QTouchEvent*>(e);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
    Q_FOREACH (const QTouchEvent::TouchPoint& point, e2->touchPoints())
#else
    Q_FOREACH (const QTouchEvent::TouchPoint& point, e2->points())
#endif
    {
      if (point.id() >= VTKI_MAX_POINTERS)
      {
        break;
      }
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
      QPointF pos = point.pos();
#else
      QPointF pos = point.position();
#endif

Here is the Qt documentation stating to not to do that.

Am I missing something here?

Thanks.

We use Qt/VTK touch and pen support on Windows and macOS and there are no issues. Probably multi-touch support in VTK just has not been tested on Linux. Or maybe it is a Qt6 issue.

I would not expect that there is a VTK developer who has access to a multi-touch capable Linux desktop and can dedicate time to work on this. So, the best would be if you could come up with fix that works for you and send a merge request.

Thanks for the answer. Actually is not only multi-touch. A single touch is even a problem (as the first point starts with an id much bigger than five.

I’ll be happy to provide a patch if I manage to find and elegant way to fix this, but my main question is still on air. I am not missing anything right?. Vtk code asumes qeventpoints ids start at zero?

Thanks again for the answer

Ok, I’ve created two MR but I am having problems with the reformat command in the Release One.

Anyway I found a solution and left it aviable for anyone who needs it.

Thanks!

1 Like

For reference @Iker_Salmon created these two merge requests:

https://gitlab.kitware.com/vtk/vtk/-/merge_requests/9110

https://gitlab.kitware.com/vtk/vtk/-/merge_requests/9124