Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-75263

WASM Single tap on mobile browsers causes touch + mouse event (double click)

    XMLWordPrintable

Details

    • WebAssembly
    • 7db9e02ad11c391c1d616defd11e7deb2718d60a

    Description

      Single tap on mobile browsers (tested with firefox and chrome) generates additional mouse press event, making everything double click.
      This is the log of an even filter (generated by one tap):

      QEvent::TouchBegin
      QEvent::TouchBegin
      QEvent::TouchEnd
      QEvent::TouchEnd
      QEvent::UpdateRequest
      QEvent::MouseMove
      QEvent::MouseButtonPress
      QEvent::MouseButtonPress
      QEvent::MouseButtonRelease
      QEvent::MouseButtonRelease
      QEvent::UpdateRequest
      QEvent::Expose
      

      There's also a >350ms delay between the touch and mouse events.

      #include <QGuiApplication>
      #include <QQmlApplicationEngine>
      #include <QDebug>
      
      class WASMTouchFilter : public QObject
      {
      public:
          bool eventFilter(QObject *watched, QEvent *event)
          {
              if (event->type() >= QEvent::TouchBegin && event->type() <= QEvent::NativeGesture ||
                      event->type() >= QEvent::MouseButtonPress && event->type() <= QEvent::MouseMove)
                  qDebug() << event->type();
              return false;
          }
      };
      
      int main(int argc, char *argv[])
      {
          QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
      
          QGuiApplication app(argc, argv);
          app.installEventFilter(new WASMTouchFilter());
          QQmlApplicationEngine engine;
          engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
          if (engine.rootObjects().isEmpty())
              return -1;
      
          return app.exec();
      }
      
      Unable to find source-code formatter for language: qml. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      import QtQuick 2.12
      import QtQuick.Controls 2.4
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
          Button {
              onClicked: console.debug("click")
          }
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            lpotter Lorn Potter
            raffarti Raffaele Pertile
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes