Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Long press from touch screen is handled different from long mouse press



  • We have a website that uses long-presses. When accessing this website from a WebEngineView in QML, we note that

    • a long-mouse-press is handled correctly
    • a long-touch-press gets translated to a right click

    Note that we see the same behavior when accessing this webpage directly from Chromium. It works fine when opening this webpage from Firefox.

    I assume that this happens because the long-touch-presses have mouse.source=Qt.MouseEventSynthesizedByQt while long-mouse-presses have mouse.source==Qt.MouseEventNotSynthesized

    So I would like to make this webpage work in WebEngineView .
    Which options do you see?

    One option I see is to recompile Qt and remove MouseEventSynthesizedByQt. This is new to me so what is the best/suggested approach here?
    Change (in qevent.cpp)

    Qt::MouseEventSource QMouseEvent::source() const
    {
        return Qt::MouseEventNotSynthesized; //QGuiApplicationPrivate::mouseEventSource(this);
    }
    

    or replace the limited number (< 10) of occurences where MouseEventSynthesizedByQt is used by MouseEventNotSynthesized?


Log in to reply