Touchscreen in WebAssembly application
-
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(); }
-
@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?
-
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.
-
I started a bug report, thanks!
https://bugreports.qt.io/browse/QTBUG-103498 -
@lorn-potter My Boss, want to use a laptop with a touchscreen display and this device have windows installed.