Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for WebAssembly
  4. Touchscreen in WebAssembly application

Touchscreen in WebAssembly application

Scheduled Pinned Locked Moved Solved Qt for WebAssembly
6 Posts 2 Posters 826 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Renio
    wrote on 5 May 2022, 09:19 last edited by
    #1

    Good morning everyone!
    I'm develop an webassembly application that must use touchscreen.
    I studied the examples:
    dials
    fingerpaint
    knobs
    pinchzoom
    (see https://doc.qt.io/qt-6/touchinputexamples.html)

    I tryed to run the tablet example (see https://doc.qt.io/qt-6/qtwidgets-widgets-tablet-example.html) compiled in webassembly but don't work.
    I have this problem:
    If I compile my application with MinGW kit (Desktop application), I'm able to move a dialog grabbed with mouse
    If I compile my application with WebAssembly kit (WebAssembly application), I'm NOT able to move a dialog tapped on title.
    But if I tap on the canvas or on any button of the dialog the touch event is catched.

    My question is: how can I perform the same behaviour in all configuration
    I posted a minimal application affected for same issue
    The example is composed by a MainWindow that show a non modal dialog, across the menu file, open.
    The dialog is a simple default QDialog with two button (ok and cancel)
    My configuration:

    Qt Creator 7.0.0
    Based on Qt 6.2.3 (MSVC 2019, 64 bit)
    From revision 638b93591b
    
    Qt 6.3.0 WebAssembly with Emscripten 3.1.6 for C++
    
    Google Chrome Ver. 101.0.4951.54
    

    thank's for your help

    here WasmDialog code:

    #include "WasmDialog.h"
    #include "ui_wasmdialog.h"
    
    #include <QDebug>
    #include <QMoveEvent>
    
    WasmDialog::WasmDialog(QWidget *parent) :
        QDialog(parent),
        ui(new Ui::WasmDialog)
    {
        ui->setupUi(this);
        setAttribute(Qt::WA_AcceptTouchEvents);
    
    } // ctr
    
    WasmDialog::~WasmDialog()
    {
        delete ui;
    } // dtr
    
    void WasmDialog::mousePressEvent(QMouseEvent *event)
    {
        qDebug() << " e->type " <<  event->type() << " e->flags " <<  event->flags();
        QDialog::mousePressEvent(event);
    }
    
    bool WasmDialog::event(QEvent *event)
    {
        switch (event->type())
        {
            case QEvent::TouchBegin:
            case QEvent::TouchUpdate:
            case QEvent::TouchEnd:
            {
                qDebug() << " e->type " <<  event->type();
                break;
            }
            default:
            {
                break;
            }
        }
        return QDialog::event(event);
    }
    
    void WasmDialog::tabletEvent(QTabletEvent *event)
    {
        switch (event->type())
        {
            case QEvent::TabletPress:
            case QEvent::TabletMove:
            {
                qDebug() << " e->type " <<  event->type();
                break;
            }
            case QEvent::TabletRelease:
            {
                qDebug() << " e->type " <<  event->type();
                update();
                break;
            }
            default:
            {
                break;
            }
        }
        QDialog::tabletEvent(event);
    }
    
    

    here MainWindow code:

    #include "MainWindow.h"
    #include "ui_mainwindow.h"
    
    
    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
        , ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
        setAttribute(Qt::WA_AcceptTouchEvents);
    
        connect(ui->actionOpen, &QAction::triggered, &moWD, &WasmDialog::show);
    } // ctr
    
    MainWindow::~MainWindow()
    {
        delete ui;
    } // dtr
    
    

    here main.cpp code:

    #include "MainWindow.h"
    
    #include <QApplication>
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        MainWindow w;
        w.show();
        return a.exec();
    }
    
    
    1 Reply Last reply
    0
    • L Offline
      L Offline
      lorn.potter
      wrote on 16 May 2022, 06:43 last edited by
      #2

      @Renio said in Touchscreen in WebAssembly application:

      ly application), I'm NOT able to move a dialog tapped on title.

      What tablet are you using? Android, iOS, Windows or some Linux version?

      Freelance Software Engineer, Platform Maintainer QtWebAssembly, Maintainer QtSensors
      Author, Hands-On Mobile and Embedded Development with Qt 5 http://bit.ly/HandsOnMobileEmbedded

      R 1 Reply Last reply 16 May 2022, 08:09
      0
      • L Offline
        L Offline
        lorn.potter
        wrote on 16 May 2022, 07:09 last edited by
        #3

        Qt 6.4.0 will have better mobile touch support. I just tested this on 6.4.0 and I cannot move the dialog, so that is a bug.

        Freelance Software Engineer, Platform Maintainer QtWebAssembly, Maintainer QtSensors
        Author, Hands-On Mobile and Embedded Development with Qt 5 http://bit.ly/HandsOnMobileEmbedded

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lorn.potter
          wrote on 16 May 2022, 07:12 last edited by
          #4

          I started a bug report, thanks!
          https://bugreports.qt.io/browse/QTBUG-103498

          Freelance Software Engineer, Platform Maintainer QtWebAssembly, Maintainer QtSensors
          Author, Hands-On Mobile and Embedded Development with Qt 5 http://bit.ly/HandsOnMobileEmbedded

          1 Reply Last reply
          1
          • L lorn.potter
            16 May 2022, 06:43

            @Renio said in Touchscreen in WebAssembly application:

            ly application), I'm NOT able to move a dialog tapped on title.

            What tablet are you using? Android, iOS, Windows or some Linux version?

            R Offline
            R Offline
            Renio
            wrote on 16 May 2022, 08:09 last edited by
            #5

            @lorn-potter My Boss, want to use a laptop with a touchscreen display and this device have windows installed.

            1 Reply Last reply
            0
            • R Offline
              R Offline
              Renio
              wrote on 27 Jun 2022, 10:23 last edited by
              #6
              This post is deleted!
              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved