Enabling touch screen in Qt4(4.8.5)/X11

  • Hello guys,
    I am beginner with Qt so need help with enabling touchscreen.
    I am using Qt4/X11 on imx6d. I have driver (kernel module) for touchscreen and it is working fine with tslib.
    What I dont know is

    1. How touch data is passed from linux input subsystem to qt. Is there any plugin for this?
      I have seen mouseplugins (linuxinput, linuxtp, tslib) but those seems to be tied with qt embedded and even after enabling during configuring qt, these plugins are not compiled at all.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Indeed the tslib plugin is used only for Qt Embedded.

    Since you are using X11, it's the Xorg server responsibility to handle these events and pass them to Qt.

  • Thanks you for reply.

    I noticed that if i connect mouse to board Qt demo app works fine, mouse event are received by app. But touch events are not detected.

    I suspect problem is with event types handled in Qt. I am using multi touch capable device. So driver is sending MT events. Even to make tslib work i had to apply patch for MT support.

    I guess Qt 4.8.5 don't support MT, not sure about this. Please correct if I am wrong.

    If above is true is there any patch to enable MT events in Qt 4.8.5.

  • Lifetime Qt Champion

    You're wrong, Qt 4 support touch events.

    Did you set the Qt::WA_AcceptTouchEvents attribute on your widgets ? Otherwise, the event will be sent has mouse events.

  • Is there any difference in simple touch events and multi touch events from Qt perspective. Or it is supposed to be X, who handle this and pass appropriate events to Qt?

    I tested using Qt demo app pathstroke and setAttribute(Qt::WA_AcceptTouchEvents); is there in app.
    Now I am going to dig a little to put logs in ProcessEvents in qeventdispatcher_x11.cpp. I hope this is place where all X events are handled.

  • Lifetime Qt Champion

    AFAIK, X should pass the events to Qt where you can then handle them.

    If you want to handle X11 events in your application you have the x11EventFilter and x11ProcessEvent methods that you can reimplement.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.